Example #1
0
    public T_Etc GetData(T_Etc.ID Id)
    {
        short id = (short)Id;

        if (itemData.ContainsKey(id))
        {
            return(itemData[id]);
        }
        //WorldMgr.ShowMessageLog("T_Etc not find >> id:"+id);
        Loger.Error("T_Etc not find >> id:" + id);
        return(null);
    }
Example #2
0
    //public List<T_Etc> GetGroup(){
    //
    //	if (groupData.ContainsKey (id)) {
    //		return groupData[id];
    //	}
    //	//WorldMgr.ShowMessageLog("T_Etc not find >> id:"+id);
    //	Loger.Error ("T_Etc not find Group >> id:"+id);
    //	return null;
    //}

    public bool HasData(T_Etc.ID Id)
    {
        short id = (short)Id;

        return(itemData.ContainsKey(id));
    }
Example #3
0
    /// <summary>
    /// 查找Button
    /// </summary>
    /// <param name="buttonPath">路径</param>
    /// <param name="action">事件</param>
    /// <param name="isAnimator">是否带点击动画</param>
    /// <param name="isSound">是否有音效</param>
    /// <param name="SoundId">音效Id (T_Etc表配置)</param>
    /// <returns></returns>
    public static Button FindButtonByTrans(Transform tf, string buttonPath, UnityAction action = null, bool isAnimator = true, bool isSound = true, T_Etc.ID SoundId = T_Etc.ID.ButtonSound)
    {
        Transform child = tf;

        if (!string.IsNullOrEmpty(buttonPath))
        {
            child = tf.FindChild(buttonPath);
        }

        if (child == null)
        {
            Loger.Error("not find button:" + buttonPath);
            return(null);
        }
        Button btn = child.GetComponent <Button>();

        if (btn == null)
        {
            btn = child.gameObject.AddComponent <Button>();
        }
        //添加事件
        if (action != null)
        {
            btn.onClick.RemoveAllListeners();
            btn.onClick.AddListener(() => {
                if (isSound == true)
                {
                    //音效
                    //SoundManager.GetInstance().F_PlayUISound(ConfigManager.Etc.GetData(SoundId).IntValue);
                }
                action();
            });
        }
        if (isAnimator == true)
        {
            btn.transition = Selectable.Transition.None;
            TransformUtil.Add <ButtonAnimator>(child);
        }
        return(btn);
    }
Example #4
0
 protected Button FindButton(string buttonPath, UnityAction action = null, bool isAnimator = true, bool isSound = true, T_Etc.ID SoundId = T_Etc.ID.ButtonSound)
 {
     return(ViewBase.FindButtonByTrans(transform, buttonPath, action, isAnimator, isSound, SoundId));
 }
Example #5
0
 /// <summary>
 /// 添加点击按钮
 /// </summary>
 protected GameObject AddClick(GameObject obj, EventTriggerListener.VoidDelegate onclick = null, bool isAnima = true, bool isSound = true, T_Etc.ID SoundId = T_Etc.ID.ButtonSound)
 {
     if (onclick != null)
     {
         //EventTriggerListener.Get(obj).onClick = onclick;
         if (isAnima == true)
         {
             AddAnimator(obj);
         }
         EventTriggerListener.Get(obj).onClick =
             (gobj) => {
             if (isSound == true)
             {
                 //音效
                 //SoundManager.GetInstance().F_PlayUISound(ConfigManager.Etc.GetData(SoundId).IntValue);
             }
             onclick(gobj);
         };
     }
     return(obj);
 }
Example #6
0
    /// <summary>
    /// 添加点击按钮
    /// </summary>
    protected GameObject AddClick(string path, EventTriggerListener.VoidDelegate onclick = null, bool isAnima = true, bool isSound = true, T_Etc.ID SoundId = T_Etc.ID.ButtonSound)
    {
        GameObject obj = FindGameObject(path);

        AddClick(obj, onclick, isAnima, isSound, SoundId);
        return(obj);
    }