9 public override object CreateExtra()
16 public override bool AlwaysBottom
41 return IntColor.FromInt(this.extra.bgColor);
45 this.extra.bgColor = IntColor.ToInt(ref value);
50 public override void OnActivate()
53 this.OnChangeResolution();
57 public override void OnSetContextMenu(UIContextMenu m)
59 SkinConfig skin = base.config.skin;
60 UIContextMenu uicontextMenu = m.AddChild(
"setting");
61 uicontextMenu.AddToggle(
"reverse", this.extra.reverse, delegate(
bool a)
63 this.extra.reverse = !this.extra.reverse;
64 this.OnChangeResolution();
66 uicontextMenu.AddSlider(
"width", (
float a) => a.ToString() ??
"", (
float)
this.extra.width, delegate(
float a)
68 this.extra.width = (int)a;
69 this.OnChangeResolution();
70 }, 10f, 50f,
true,
true,
false);
71 uicontextMenu.AddSlider(
"image", (
float a) => a.ToString() ??
"", (
float)
this.extra.idImage, delegate(
float a)
73 this.extra.idImage = (int)a;
74 this.OnChangeResolution();
75 }, 0f, (float)(this.sprites.Length - 1),
true,
true,
false);
76 uicontextMenu.AddButton(
"colorBG", delegate()
78 EMono.ui.AddLayer<
LayerColorPicker>().SetColor(this.bgColor, Color.white, delegate(PickerState state, Color _c)
81 this.OnChangeResolution();
84 base.SetBaseContextMenu(m);
90 EMono.scene.cam.rect = (this.extra.reverse ?
new Rect(0.01f * (
float)this.extra.width, 0f, 1f + 0.01f * (
float)
this.extra.width, 1f) :
new Rect(-0.01f * (
float)this.extra.width, 0f, 1f, 1f));
94 public override void OnChangeResolution()
96 base.OnChangeResolution();
97 RectTransform rectTransform = this.Rect();
98 float x = 0.01f * (float)Screen.width * (
float)this.extra.width / EMono.core.uiScale + 50f;
99 float num = (float)Screen.height /
EMono.core.uiScale + 50f;
100 rectTransform.sizeDelta =
new Vector2(x, num);
101 if (this.extra.reverse)
103 rectTransform.SetAnchor(0f, 0.5f, 0f, 0.5f);
104 rectTransform.anchoredPosition =
new Vector2(rectTransform.sizeDelta.x * 0.5f, 0f);
108 rectTransform.SetAnchor(1f, 0.5f, 1f, 0.5f);
109 rectTransform.anchoredPosition =
new Vector2(rectTransform.sizeDelta.x * -0.5f, 0f);
112 this.imagePic.SetActive(this.extra.idImage > 0);
113 Sprite sprite = this.sprites[this.extra.idImage];
116 this.imagePic.sprite = sprite;
117 this.imagePic.rectTransform.sizeDelta =
new Vector2(num * (
float)sprite.texture.width / (
float)sprite.texture.height, num);
118 this.imagePic.color = this.bgColor;
123 private void OnEnable()
129 private void OnDisable()
131 EMono.scene.cam.rect =
new Rect(0f, 0f, 1f, 1f);
135 public Sprite[] sprites;
138 public Image imagePic;