protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressCloseLibrary pressCloseLibrary) { AddListener(pressCloseLibrary.CloseLibrary); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressEndTurn pressEndTurn) { AddListener(pressEndTurn.PressRandomMove); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressDamage passTurn) { AddListener(passTurn.PressDamageMove); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressReveal pressReveal) { AddListener(pressReveal.Reveal); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressWin win) { AddListener(win.PressWin); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IFinishBattle finish) { AddListener(finish.FinishBattle); } }
public Button(string name, IButtonHandler handler) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } if (handler == null) { throw new ArgumentNullException(nameof(handler)); } _handler = handler; Name = name; Width = 50; Height = 20; Location = new Vector2(100, 100); Enabled = true; Visible = true; Text = "My Button"; Color = Color.LightGray; OutlineColor = Color.Gray; MouseOverColor = Color.Gray; TextColor = Color.Black; MouseOverTextColor = Color.Khaki; DrawWindowChrome = true; _font = Engine.Content.Load <SpriteFont>("default"); }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressPassTurn pressRandom) { AddListener(pressRandom.PassTurn); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressDraw pressDraw) { AddListener(pressDraw.Draw); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressLose lose) { AddListener(lose.PressLose); } }
public static void MapText(IButtonHandler handler, IText button) { handler.PlatformView?.UpdateText(button); // Any text update requires that we update any attributed string formatting MapFormatting(handler, button); }
public static void MapLineBreakMode(IButtonHandler handler, IButton button) { if (button is ILineBreakMode lineBreakMode) { handler.PlatformView?.UpdateLineBreakMode(lineBreakMode); } }
protected override void OnSetHandler(IButtonHandler handler) { if (handler is IPressRestart restart) { AddListener(restart.PressRestart); } }
public static Task MapImageSourceAsync(IButtonHandler handler, IImage image) { if (image.Source == null) { return(Task.CompletedTask); } return(handler.ImageSourceLoader.UpdateImageSourceAsync()); }
//private void RegisterButtonHandlerList() //{ // foreach (var btn in buttonList) // { // handler.RegistButtonHandler(btn.handler); // } //} public IButtonHandler[] GetStaticButtonArray() { IButtonHandler[] btnArr = new IButtonHandler[buttonList.Count]; for (int i = 0; i < btnArr.Length; i++) { btnArr[i] = buttonList[i].handler; } return(btnArr); }
private bool executeKeyDown(string key) { foreach (IOutputHandler handler in outputHandlers) { IButtonHandler buttonHandler = handler as IButtonHandler; if (buttonHandler != null) { if (buttonHandler.setButtonDown(key)) { return(true); } } } return(false); }
public void SetButtonHandler(int x, int y, IButtonHandler handler) { if (x >= 0 && x < 8 && y >= 0 && y < 8) { int index = GridCoordsToIndex(x, y); while (_handlers.Count <= index) { _handlers.Add(null); } _handlers[index] = handler; UnityEditor.EditorUtility.SetDirty(this); } }
public void RegistButtonHandler(IButtonHandler btn) { LifeCheck(); int id = btn.ID; if (HasButtonHandler(id)) { RemoveButtonHandler(id); buttonHandlerList.Add(id, btn); btn.Initialize(this); log += string.Format("RegistButton(id:{1},btn{2})\n移除重覆ButtonHandler\n{0}\n\n", Utilty.CallStack(), id, btn); } else { buttonHandlerList.Add(id, btn); btn.Initialize(this); log += string.Format("RegistButton(id:{1},btn{2})\n{0}\n\n", Utilty.CallStack(), id, btn); } if (onButtonRegisted != null) { onButtonRegisted(this, new RegistButtonArgs(btn)); } }
public bool GetLedState(GlowingButton button) { if (button.position == DeleteStoredDataButtonHandler.currentDeletePosition) { return(true); } IButtonHandler buttonHandler = GridController.gridConfig.GetButtonHandler(button.x, button.y); float time = (float)(UnityEditor.EditorApplication.timeSinceStartup - startTime) * frequency; Vector2 offset = DeleteStoredDataButtonHandler.currentDeletePosition - button.position; time -= offset.magnitude * 0.05f; if (buttonHandler != null && buttonHandler is IDeleteStoredData && (buttonHandler as IDeleteStoredData).HasStoredData) { IDeleteStoredData deleter = buttonHandler as IDeleteStoredData; return(time > 0 && (time < dutyCycleNormal || Mathf.Repeat((float)UnityEditor.EditorApplication.timeSinceStartup * frequency, 1) < dutyCycleOn)); } return(time > 0 && time < dutyCycleNormal); }
public static void MapStrokeColor(IButtonHandler handler, IButtonStroke buttonStroke) { handler.PlatformView?.UpdateStrokeColor(buttonStroke); }
public static void MapLineBreakMode(IButtonHandler handler, Button button) { handler.PlatformView?.UpdateLineBreakMode(button); }
public static void MapFormatting(IButtonHandler handler, IText button) { // Update all of the attributed text formatting properties handler.PlatformView?.UpdateCharacterSpacing(button); }
public static void MapFont(IButtonHandler handler, ITextStyle button) { var fontManager = handler.GetRequiredService <IFontManager>(); handler.PlatformView?.UpdateFont(button, fontManager); }
public static void MapPadding(IButtonHandler handler, IButton button) { handler.PlatformView?.UpdatePadding(button, DefaultPadding); }
public static void MapCharacterSpacing(IButtonHandler handler, ITextStyle button) { handler.PlatformView?.UpdateCharacterSpacing(button); }
public static void MapTextColor(IButtonHandler handler, ITextStyle button) { handler.PlatformView?.UpdateTextColor(button); }
public static void MapCornerRadius(IButtonHandler handler, IButtonStroke buttonStroke) { handler.PlatformView?.UpdateCornerRadius(buttonStroke); }
public static void MapStrokeThickness(IButtonHandler handler, IButtonStroke buttonStroke) { handler.PlatformView?.UpdateStrokeThickness(buttonStroke); }
/// <summary> Override this function to implement the funcionality. </summary> /// <param name="handler"></param> protected abstract void OnSetHandler(IButtonHandler handler);
public static void MapImageSource(IButtonHandler handler, IImage image) => MapImageSourceAsync(handler, image).FireAndForget(handler);
void Setup() { SetButtons(); _board = BoardFactory.GetFactory().GetDefaultBoard(); _moveModule = MoveModule.GetBuilder().BoardIs(_board).Build(); _buttonHandler = ButtonHandler.GetBuilder().BoardIs(_board).ButtonsAre(_buttons).Build(); _buttonHandler.Update(null, null, null); }