Пример #1
0
 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);
             }
         }
     }
 }
Пример #2
0
    void Awake()
    {
        _btn = this.GetComponentInChildren <CommonButton> ();
        _btn.OnClick.AddListener(OnClick);

        _label = this.GetComponentInChildren <UIText>();
    }
Пример #3
0
    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();
        }
    }
Пример #4
0
    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);
    }
Пример #6
0
        protected override void Awake()
        {
            base.Awake();

            btnGuest  = transform.GetChildByName("ButtonGuest").GetComponent <CommonButton> ();
            btnGoogle = transform.GetChildByName("ButtonGoogle").GetComponent <CommonButton> ();
            //btnGoogle = transform.GetChildByName ("ButtonFacebook").GetComponent<CommonButton> ();
        }
Пример #7
0
        /// <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;
        }
Пример #8
0
        public bool ButtonPressed(CommonButton button)
        {
            if (device.TryGetFeatureValue(GetCommonButton(button), out bool pressed))
            {
                return(pressed);
            }

            return(false);
        }
Пример #9
0
 protected override void Awake()
 {
     base.Awake();
     btnPlayClassic = transform.GetChildByName("ButtonPlayClassic").GetComponent <CommonButton> ();
     if (btnPlayerProfile != null)
     {
         btnPlayerProfile.OnClick.AddListener(OnShowPlayerProfile);
     }
 }
Пример #10
0
        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);
         }
     }
 }
Пример #12
0
 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();
         }
     }
 }
Пример #13
0
 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;
         }
     }
 }
Пример #14
0
 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);
         }
     }
 }
Пример #15
0
    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);
    }
Пример #16
0
        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);
        }
Пример #17
0
    // 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); });
    }
Пример #18
0
    // 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);
    }
Пример #19
0
    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;
            }
        }
    }
Пример #20
0
 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(); });
 }
Пример #22
0
        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);
            }
        }
Пример #23
0
 /// <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));
 }
Пример #24
0
 private void OnEnable()
 {
     button = PlayerController.instance.keyList.GetByKeyType((KeyType)keyType);
 }
Пример #25
0
 void Start()
 {
     text   = GetComponentInChildren <Text>();
     anim   = GetComponent <Animator>();
     button = PlayerController.instance.keyList.GetByKeyType((KeyType)keyType);
 }
Пример #26
0
 private void OnClickMove(CommonButton b)
 {
     cbMoveClick?.Invoke();
 }
Пример #27
0
 private void OnClickQuit(CommonButton b)
 {
     cbQuitClick?.Invoke();
 }
Пример #28
0
 private void OnClickConfirm(CommonButton b)
 {
     cbConfirmClick?.Invoke();
 }
Пример #29
0
 private void OnClickMarker(CommonButton b)
 {
 }
Пример #30
0
 private void OnClickRotate(CommonButton b)
 {
     cbRotateClick?.Invoke();
 }