public override void OnInspectorGUI() { _myScript = (ColorBank)target; EditorGUILayout.BeginVertical("box"); GUILayout.Space(5); GUILayout.Label("Colors"); GUILayout.Space(5); if (GUILayout.Button("Recalculate Colors")) { _action = InspectorButton.RecalculateColors; } GUILayout.Space(5); EditorGUILayout.EndVertical(); //-------------------------------------------------------------------------------------------------------------------------------------------------------- GUILayout.Space(20); // CONFIRM //-------------------------------------------------------------------------------------------------------------------------------------------------------- if (_setupConfirm) { EditorGUILayout.BeginVertical("box"); GUILayout.Space(5); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Confirm", GUILayout.Width(Find(_percent: 25, _of: Screen.width)), GUILayout.Height(50))) { ConfirmAccepted(); } if (GUILayout.Button("Cancel", GUILayout.Width(Find(_percent: 25, _of: Screen.width)), GUILayout.Height(50))) { _setupConfirm = false; } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); EditorGUILayout.EndVertical(); } // Show default inspector property editor DrawDefaultInspector(); }
public ChoiceScene() : base() { linePaint = new Paint(); linePaint.Color = ColorBank.GetColor(ColorBank.Red); linePaint.StrokeWidth = 6 * GameView.scaleFactor; lineLR = 308 * GameView.scaleFactor; lineX = 80 * GameView.scaleFactor; Rect bounds = new Rect((int)(-310 * GameView.scaleFactor), (int)(-90 * GameView.scaleFactor), (int)(310 * GameView.scaleFactor), (int)(235 * GameView.scaleFactor)); spButton = CreateItem(Resource.Drawable.choice_singleplayer, "SINGLEPLAYER", bounds, 0, -170 * GameView.scaleFactor); spButton.Pressed += () => { Hide(Side.Left); SingleGameRunupScene.Instance.Show(Side.Right); }; bounds = new Rect(bounds); bounds.Top = (int)(-130 * GameView.scaleFactor); mpButton = CreateItem(Resource.Drawable.choice_multiplayer, "MULTIPLAYER", bounds, 0, 240 * GameView.scaleFactor); int size = (int)(90 * GameView.scaleFactor); Bitmap backBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.back, size, size); BitmapContent backContent = new BitmapContent(backBitmap, null); int hb = (int)(80 * GameView.scaleFactor); backButton = new Button(backContent, new Rect(-hb, -hb, hb, hb), pivot, -265 * GameView.scaleFactor, -380 * GameView.scaleFactor); backButton.Pressed += () => { MenuScene.Instance.Show(Side.Left); Hide(Side.Right); }; }
public TopBar() : base() { int size = (int)(110 * GameView.scaleFactor); int vSize = (int)(size / 1.2); Rect bounds = new Rect(-vSize, -vSize, vSize, vSize); vSize = (int)(size / 1.5); float x = 360 * GameView.scaleFactor - vSize; float y = -640 * GameView.scaleFactor + vSize; Bitmap nightmodeBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.top_nightmode, size, size); Bitmap daymodeBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.top_daymode, size, size); BitmapContent nightmode = new BitmapContent(nightmodeBitmap, null); BitmapContent daymode = new BitmapContent(daymodeBitmap, null); int s = (ColorBank.CurrentBgCoef < 0.5) ? 0 : 1; dayNightSwitch = new SwitchButton(s, new DrawablePart[] { nightmode, daymode }, bounds, pivot, x, y); dayNightSwitch.StateChanged += (state) => ColorBank.ChangeBackgroundColor(state == 0); x = -x; Bitmap soundOffBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.top_soundoff, size, size); Bitmap soundOnBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.top_soundon, size, size); BitmapContent soundOff = new BitmapContent(soundOffBitmap, null); BitmapContent soundOn = new BitmapContent(soundOnBitmap, null); int st = (SoundMaster.Volume < 0.5) ? 0 : 1; soundSwitch = new SwitchButton(st, new DrawablePart[] { soundOff, soundOn }, bounds, pivot, x, y); soundSwitch.StateChanged += (state) => SoundMaster.SetVolume(state); }
void Awake() { _colorBank = this; DontDestroyOnLoad(this); }
void Awake() { _colorBank = this; }