Exemple #1
0
    public void addHashedButton(string hashString_, int hashInt, superButtonType type, string hint)
    {
        gameUIbutton hashedButton = new gameUIbutton();
        string       hashString   = hashString_;

        if (hashString == "")
        {
            hashString = hashInt.ToString();
        }
        hashedButton.hashString = hashString;
        hashedButton.response   = hashInt;
        hashedButton.gameObject = Program.I().create(Program.I().new_ui_superButtonTransparent);
        UIHelper.trySetLableText(hashedButton.gameObject, "hint_", hint);
        UIHelper.getRealEventGameObject(hashedButton.gameObject).name = hashString + "----" + hashInt.ToString();
        UIHelper.registUIEventTriggerForClick(hashedButton.gameObject, listenerForClicked);
        hashedButton.gameObject.GetComponent <iconSetForButton>().setTexture(type);
        hashedButton.gameObject.GetComponent <iconSetForButton>().setText(hint);
        Transform[] Transforms = hashedButton.gameObject.GetComponentsInChildren <Transform>();
        foreach (Transform child in Transforms)
        {
            child.gameObject.layer = instance_btnPan.gameObject.layer;
        }
        hashedButton.gameObject.transform.SetParent(instance_btnPan.transform, false);
        hashedButton.gameObject.transform.localScale       = Vector3.zero;
        hashedButton.gameObject.transform.localPosition    = Vector3.zero;
        hashedButton.gameObject.transform.localEulerAngles = Vector3.zero;
        iTween.ScaleTo(hashedButton.gameObject, new Vector3(0.9f, 0.9f, 0.9f), 0.3f);
        HashedButtons.Add(hashedButton);
        refreshLine();
    }
Exemple #2
0
    public void removeHashedButton(string hashString)
    {
        gameUIbutton remove = null;

        for (int i = 0; i < HashedButtons.Count; i++)
        {
            if (HashedButtons[i].hashString == hashString)
            {
                remove = HashedButtons[i];
            }
        }
        if (remove != null)
        {
            if (remove.gameObject != null)
            {
                Program.I().destroy(remove.gameObject, 0.6f, true);
            }
            HashedButtons.Remove(remove);
        }
        refreshLine();
    }