private void CreateCornerTile(Form form, int i, int j) { CornerControl cornerControl = new CornerControl(); cornerControl.oPicture.Image = File.GetImageFromName(_board[i, j].Name + ".png"); int[] position = GetTileLocation(i, j);; cornerControl.Location = new Point(position[0], position[1]); form.Controls.Add(cornerControl); }
void OnEnable() { blending = GetComponent <Blending>(); targetCamera = GetComponent <Camera>(); blending.enabled = true; mouseTracker.Clear(); mouseCurr = new MousePosition(targetCamera, blending.BlendingData); fsmTrackerTargetMode = new FSM <TargetModeEnum>(this); fsmGUIMode = new FSM <GUIModeEnum>(this); cornerControl = new CornerControl(this, blending, mouseTracker, mouseCurr); edgeControl = new EdgeControl(this, blending, mouseTracker, mouseCurr); blendControl = new BlendControl(this, blending, mouseTracker, mouseCurr); #region FSM Setup fsmTrackerTargetMode.State(TargetModeEnum.None); fsmTrackerTargetMode.State(TargetModeEnum.Corner) .Enter(fsm => cornerControl.Activity = true) .Update(fsm => cornerControl.Update()) .Exit(fsm => cornerControl.Activity = false); fsmTrackerTargetMode.State(TargetModeEnum.Edge) .Enter(fsm => edgeControl.Activity = true) .Update(fsm => edgeControl.Update()) .Exit(fsm => edgeControl.Activity = false); fsmTrackerTargetMode.State(TargetModeEnum.Blend) .Enter(fsm => blendControl.Activity = true) .Update(fsm => blendControl.Update()) .Exit(fsm => blendControl.Activity = false); fsmTrackerTargetMode.Init(); fsmGUIMode.State(GUIModeEnum.Hidden).Update(fsm => { if (Input.GetKeyDown(config.guiModeToggleKey)) { fsm.Goto(GUIModeEnum.Show); } }); fsmGUIMode.State(GUIModeEnum.Show).Update(fsm => { if (Input.GetKeyDown(config.guiModeToggleKey)) { fsm.Goto(GUIModeEnum.Hidden); } }); fsmGUIMode.Init(); #endregion #region Reactive setup trackerMode.Changed += (r => { fsmTrackerTargetMode.Goto(r.Value); trackerIndex.Value = EnumOperator <TargetModeEnum> .FindIndex(r.Value); }); trackerIndex.Changed += (r => { trackerMode.Value = EnumOperator <TargetModeEnum> .ValueAt(r.Value); }); screenColumnCount.Changed += (r => { UpdateScreenSetup(r.Value, screenRowCount.Value); screenColumnCountText.Value = r.Value.ToString(); }); screenRowCount.Changed += (r => { UpdateScreenSetup(screenColumnCount.Value, r.Value); screenRowCountText.Value = r.Value.ToString(); }); screenColumnCountText.Changed += (r => { int nextValue; if (int.TryParse(r.Value, out nextValue)) { screenColumnCount.Value = Mathf.Max(1, nextValue); } }); screenRowCountText.Changed += (r => { int nextValue; if (int.TryParse(r.Value, out nextValue)) { screenRowCount.Value = Mathf.Max(1, nextValue); } }); outputMode.Changed += (r => { blending.BlendingData.OutputKeyword = r.Value; outputIndex.Value = EnumOperator <KwOutput> .FindIndex(r.Value); }); outputIndex.Changed += (r => { outputMode.Value = EnumOperator <KwOutput> .ValueAt(r.Value); }); wireframeMode.Changed += (r => { blending.BlendingData.WireframeKeyword = r.Value; wireframeIndex.Value = EnumOperator <KwWireframe> .FindIndex(r.Value); }); wireframeIndex.Changed += (r => { wireframeMode.Value = EnumOperator <KwWireframe> .ValueAt(r.Value); }); textureBlendMode.Changed += (r => { blending.BlendingData.TextureBlendkeyword = r.Value; textureBlendIndex.Value = EnumOperator <KwTextureBlend> .FindIndex(r.Value); }); textureBlendIndex.Changed += (r => textureBlendMode.Value = EnumOperator <KwTextureBlend> .ValueAt(r.Value)); maskTextureIndex.Changed += (r => { blending.BlendingData.MaskTextureIndex = r.Value; maskTextureIndexText.Value = r.Value.ToString(); }); maskTextureIndexText.Changed += (r => { int nextValue; if (int.TryParse(r.Value, out nextValue)) { maskTextureIndex.Value = nextValue; } }); #endregion Load(); UpdateScreenSetup(screenColumnCount.Value, screenRowCount.Value); }