protected override void OnPreRender(EventArgs e) { try { base.OnPreRender(e); } catch { } _wasPreRender = true; for (int i = 0; i < Controls.Count; i++) { CommonButton button = Controls[i] as CommonButton; if (button != null) { if (!IsDesign) { if (!button.PreservePlace) { button.Style[HtmlTextWriterStyle.Display] = "none"; } else { button.Style[HtmlTextWriterStyle.Visibility] = "hidden"; } } else { button.Style.Remove(HtmlTextWriterStyle.Display); button.Style.Remove(HtmlTextWriterStyle.Visibility); } } } }
void Awake() { _btn = this.GetComponentInChildren <CommonButton> (); _btn.OnClick.AddListener(OnClick); _label = this.GetComponentInChildren <UIText>(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("Repaint")) { RepaintButton(); } if (GUILayout.Button("ChangeBlock")) { for (int i = 0; i < targets.Length; i++) { if (targets[i] is CommonButton) { CommonButton btnTarget = (CommonButton)targets[i]; btnTarget.ChangeBlock(); btnTarget.SetStyle(); btnTarget.SetBlock(); } } } if (GUI.changed) { RepaintButton(); } }
public void RankingCallback() { float verticalNormalizedPosition = 1f; if (ELSingleton <FacebookManager> .Instance.currentRanking.state == FacebookManager.FBRankingState.DONE) { loading.SetActive(value: false); if (ELSingleton <FacebookManager> .Instance.currentRanking.players.Count == 0) { Text text = Object.Instantiate(messagePrefab, content.transform); text.text = "Nobody from your friends play Word Stickers!?\nInvite your friend to compete in friend leaderboard"; itemList.Add(text.GetComponent <RectTransform>()); } int num = 0; foreach (Player player in ELSingleton <FacebookManager> .Instance.currentRanking.players) { if (num == 10 && ELSingleton <FacebookManager> .Instance.currentRanking.type == FacebookManager.FBRankingType.GLOBAL) { Text text2 = Object.Instantiate(messagePrefab, content.transform); text2.text = "..."; RectTransform component = text2.GetComponent <RectTransform>(); component.sizeDelta = new Vector2(component.sizeDelta.x, 30f); itemList.Add(component); } if (ELSingleton <FacebookManager> .Instance.currentRanking.type == FacebookManager.FBRankingType.FRIENDS) { player.rank = num + 1; } if (player.id.Equals(ELSingleton <FacebookManager> .Instance.player.id)) { verticalNormalizedPosition = 1f - 1f * (float)num / (float)(ELSingleton <FacebookManager> .Instance.currentRanking.players.Count - 1); } RankingPlayer rankingPlayer = Object.Instantiate((ELSingleton <FacebookManager> .Instance.currentRanking.type == FacebookManager.FBRankingType.FRIENDS) ? playerPrefabFB : playerPrefabNormal, content.transform); rankingPlayer.Prepare(player, ELSingleton <FacebookManager> .Instance.GetAvatarSprite(player.fbId)); itemList.Add(rankingPlayer.GetComponent <RectTransform>()); num++; } CommonButton commonButton = Object.Instantiate(inviteButton, content.transform); commonButton.Show(); commonButton.OnClick.AddListener(InviteButton); itemList.Add(commonButton.GetComponent <RectTransform>()); } else if (ELSingleton <FacebookManager> .Instance.currentRanking.state == FacebookManager.FBRankingState.ERROR) { loading.SetActive(value: false); Text text3 = Object.Instantiate(messagePrefab, content.transform); itemList.Add(text3.GetComponent <RectTransform>()); } else { loading.SetActive(value: true); } float y = UpdateLayout(); RectTransform component2 = content.GetComponent <RectTransform>(); component2.sizeDelta = new Vector2(component2.sizeDelta.x, y); scrollRect.verticalNormalizedPosition = verticalNormalizedPosition; scrollPosition = verticalNormalizedPosition; setScrollPosition = true; }
private void OnBtnClick(IButton btn) { CommonButton tmpBtn = (CommonButton)btn; int idx = btns.IndexOf(tmpBtn); ChangePage(idx); }
protected override void Awake() { base.Awake(); btnGuest = transform.GetChildByName("ButtonGuest").GetComponent <CommonButton> (); btnGoogle = transform.GetChildByName("ButtonGoogle").GetComponent <CommonButton> (); //btnGoogle = transform.GetChildByName ("ButtonFacebook").GetComponent<CommonButton> (); }
/// <summary> /// Initializes a new Task Dialog instance with an instruction, a title, some /// content text and a specific button.</summary> /// <param name="instruction">The main instruction to display.</param> /// <param name="title">The title of the Task Dialog.</param> /// <param name="content">The content text that will be shown below the main instruction.</param> /// <param name="commonButtons">Specifies one or more buttons to be displayed on the bottom of the dialog, instead of the default OK button.</param> public TaskDialog(string instruction, string title, string content, CommonButton commonButtons) { Init(); Title = title; Instruction = instruction; Content = content; CommonButtons = commonButtons; }
public bool ButtonPressed(CommonButton button) { if (device.TryGetFeatureValue(GetCommonButton(button), out bool pressed)) { return(pressed); } return(false); }
protected override void Awake() { base.Awake(); btnPlayClassic = transform.GetChildByName("ButtonPlayClassic").GetComponent <CommonButton> (); if (btnPlayerProfile != null) { btnPlayerProfile.OnClick.AddListener(OnShowPlayerProfile); } }
private void OnClickLogin(CommonButton btn) { string name = nameText.text.Trim(); string pass = passText.text.Trim(); if (callbackLogin != null) { callbackLogin(name, pass); } }
void Awake() { for (int i = 0; i < btns.Count; i++) { CommonButton btn = btns [i]; if (btn != null) { btn.OnClick.AddListener(OnBtnClick); } } }
private void RepaintButton() { for (int i = 0; i < targets.Length; i++) { if (targets[i] is CommonButton) { CommonButton btnTarget = (CommonButton)targets[i]; btnTarget.SetStyle(); btnTarget.SetBlock(); } } }
public void SetupButton(KeyType keyType, ControlSetupMenu.ResetSelectedCall resetSelectedCall) { isWaitingSetup = true; foreach (CommonButton commonButton in keyList.buttons) { if (keyType == commonButton.GetKeyType()) { waitingSetupKey = commonButton; this.resetSelectedCall = resetSelectedCall; break; } } }
internal void CreateChilds(DesignerWithMapPath designer) { this.Controls.Clear(); this.CreateChildControls(); for (int i = 0; i < Controls.Count; i++) { CommonButton button = Controls[i] as CommonButton; if (button != null) { button.CreateChilds(designer); } } }
public void AddCommonButton(tk2dUIItem target) { CommonButton targetBtn = target.gameObject.GetComponent <CommonButton>(); if (targetBtn == null) { targetBtn = target.gameObject.AddComponent <CommonButton>(); } targetBtn.m_btnButton = target; targetBtn.m_spriteIcon = targetBtn.GetComponentInChildren <tk2dSprite>(true); targetBtn.m_spriteButtonUp = targetBtn.GetComponentInChildren <tk2dBaseSprite>(true); targetBtn.m_collButton = targetBtn.GetComponentInChildren <Collider>(true); targetBtn.m_textUp = targetBtn.GetComponentInChildren <tk2dTextMesh>(true); }
public static InputFeatureUsage <bool> GetCommonButton(CommonButton button) { if (button == CommonButton.gripButton) { return(CommonUsages.gripButton); } if (button == CommonButton.menuButton) { return(CommonUsages.menuButton); } if (button == CommonButton.primary2DAxisClick) { return(CommonUsages.primary2DAxisClick); } if (button == CommonButton.primary2DAxisTouch) { return(CommonUsages.primary2DAxisTouch); } if (button == CommonButton.primaryButton) { return(CommonUsages.primaryButton); } if (button == CommonButton.primaryTouch) { return(CommonUsages.primaryTouch); } if (button == CommonButton.secondary2DAxisClick) { return(CommonUsages.secondary2DAxisClick); } if (button == CommonButton.secondary2DAxisTouch) { return(CommonUsages.secondary2DAxisTouch); } if (button == CommonButton.secondaryButton) { return(CommonUsages.secondaryButton); } if (button == CommonButton.secondaryTouch) { return(CommonUsages.secondaryTouch); } return(CommonUsages.triggerButton); }
// Start is called before the first frame update void Start() { int categoryId = GlobalStorage.CurrentCategory; string categoryTitleImge = string.Format(@"images/category-title-{0}", categoryId); categorySprite.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(categoryTitleImge); CommonButton button = categorySprite.GetComponent <CommonButton>(); button.SetCallback(() => { this.EnterCategory(); }); leftArror.SetActive(categoryId > 1); rightArror.SetActive(categoryId < 3); leftArror.GetComponent <CommonButton>().SetCallback(() => { this.ChangeCategory(false); }); rightArror.GetComponent <CommonButton>().SetCallback(() => { this.ChangeCategory(true); }); }
// Start is called before the first frame update void Start() { CommonButton button = enterGameButton.GetComponent <CommonButton>(); button.SetCallback(() => { this.EnterGame(); }); Debug.Log("Application.persistentDataPath: " + Application.persistentDataPath); if (GlobalStorage.LoadGameData() == null) { // Create a new GameData GameData data = new GameData(); data.RevealCount = 0; GlobalStorage.SaveGame(data); } var backgroundImage = string.Format(@"images/welcome_{0}", Random.Range(1, 4)); background.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(backgroundImage); }
public void RefreshButton() { //controlConfig = Resources.Load<TextAsset>("Config/control"); string configJson = PlayerPrefs.GetString("PlayerController"); if (configJson == null || configJson == "") { DefaultButton(); //TextAsset controlConfig = Resources.Load<TextAsset>("Config/control.json"); //configJson = controlConfig.text; //configJson = File.ReadAllText(configPath); configJson = JsonUtility.ToJson(keyList, true); PlayerPrefs.SetString("PlayerController", configJson); } keyList = JsonUtility.FromJson <CommonButtonList>(configJson); foreach (CommonButton tempButton in keyList.buttons) { switch (tempButton.GetKeyType()) { case KeyType.LEFT: leftKey = tempButton; break; case KeyType.RIGHT: rightKey = tempButton; break; case KeyType.UP: upKey = tempButton; break; case KeyType.DOWN: downKey = tempButton; break; case KeyType.SLASH: slashKey = tempButton; break; case KeyType.SHOOT: shootKey = tempButton; break; case KeyType.JUMP: jumpKey = tempButton; break; case KeyType.DASH: dashKey = tempButton; break; default: break; } } }
private void OnClickGaze(CommonButton b) { cbGazeClick?.Invoke(); }
// Start is called before the first frame update void Start() { m_CommonButton = GameObject.Find("ButtonManager").GetComponent <CommonButton>(); this.GetComponent <Button>().onClick.AddListener(delegate { m_CommonButton.SelectMapButtonDown(); }); }
private static CommonButtonResult InternalShow(IntPtr parent, string title, string instruction, string content, CommonButton commonButtons, CommonIcon icon) { int dlgValue; try { //Get handle for parent window if none specified (behave like MessageBox) if (parent == IntPtr.Zero) { parent = Native.Methods.GetActiveWindow(); } if (NativeMethods.TaskDialog(parent, IntPtr.Zero, title, instruction, content, (int)commonButtons, new IntPtr((long)icon), out dlgValue) != 0) { throw new Exception(string.Format(Resources.ExceptionMessages.NativeCallFailure, "TaskDialog")); } } catch (EntryPointNotFoundException ex) { throw new Exception(Resources.ExceptionMessages.CommonControlEntryPointNotFound, ex); } catch (Exception ex) { throw new Exception(Resources.ExceptionMessages.TaskDialogFailure, ex); } //Convert int value to common dialog result if (dlgValue > 0 && dlgValue <= 8) { return((CommonButtonResult)dlgValue); } else { return(CommonButtonResult.None); } }
/// <summary>Displays a task dialog that has a message, a title, an instruction, one or more buttons, and an icon.</summary> /// <param name="text">The text to display.</param> /// <param name="title">The title bar caption of the dialog.</param> /// <param name="instruction">The instruction shown below the main text.</param> /// <param name="buttons">Value that specifies which button or buttons to display.</param> /// <param name="icon">The icon to display.</param> public static CommonButtonResult Show(string instruction, string title, string content, CommonButton buttons, CommonIcon icon) { return(InternalShow(IntPtr.Zero, title, instruction, content, buttons, icon)); }
private void OnEnable() { button = PlayerController.instance.keyList.GetByKeyType((KeyType)keyType); }
void Start() { text = GetComponentInChildren <Text>(); anim = GetComponent <Animator>(); button = PlayerController.instance.keyList.GetByKeyType((KeyType)keyType); }
private void OnClickMove(CommonButton b) { cbMoveClick?.Invoke(); }
private void OnClickQuit(CommonButton b) { cbQuitClick?.Invoke(); }
private void OnClickConfirm(CommonButton b) { cbConfirmClick?.Invoke(); }
private void OnClickMarker(CommonButton b) { }
private void OnClickRotate(CommonButton b) { cbRotateClick?.Invoke(); }