Example #1
0
    /// <summary>
    /// 删除游戏文本信息UI.
    /// </summary>
    internal void RemoveGameTextUI(GameTextState textState)
    {
        TextDate textDt = m_TextDtList.Find((dt) => { return(dt.m_TextState.Equals(textState)); });

        if (textDt != null)
        {
            if (textDt.m_GameTextUI != null)
            {
                Destroy(textDt.m_GameTextUI);
            }
            m_TextDtList.Remove(textDt);
        }
    }
Example #2
0
    /// <summary>
    /// 产生游戏文本信息UI.
    /// </summary>
    public void SpawnGameTextUI(GameTextState textState, Transform uiParent)
    {
        TextDate textDt = m_TextDtList.Find((dt) => { return(dt.m_TextState.Equals(textState)); });

        if (textDt != null)
        {
            UnityLogWarning("SpawnGameTextUI -> The TextUI have been created! textState ==== " + textState);
            return;
        }

        string uiTextPrefabPath = "";

        switch (textState)
        {
        case GameTextState.DengDuiFangTongYiPK:
        {
            uiTextPrefabPath = "Prefabs/GUI/GameTextInfo/DengDaiDuiFangTongYiPK";
            break;
        }

        case GameTextState.KaiShiShuangRenPK:
        {
            uiTextPrefabPath = "Prefabs/GUI/GameTextInfo/KaiShiShuangRenPK";
            break;
        }

        case GameTextState.DuiFangBuYingZhan_DengDuiFangJieShu:
        {
            uiTextPrefabPath = "Prefabs/GUI/GameTextInfo/DuiFangBuGanYingZhan_DengDuiFangJieShu";
            break;
        }

        case GameTextState.DengDuiFangJieShu:
        {
            uiTextPrefabPath = "Prefabs/GUI/GameTextInfo/DengDuiFangJieShu";
            break;
        }

        case GameTextState.DuiFangBuYingZhan_JiXuDengDai:
        {
            uiTextPrefabPath = "Prefabs/GUI/GameTextInfo/DuiFangBuGanYingZhan_JiXuDeng";
            break;
        }

        case GameTextState.DuiFangYiLiKai_QieWeiDanRen:
        {
            uiTextPrefabPath = "Prefabs/GUI/GameTextInfo/DuiFangYiLiKai_QieWeiDanRen";
            break;
        }

        default:
        {
            UnityLogWarning("SpawnGameTextUI -> have not registered textState ==== " + textState);
            return;
        }
        }

        GameObject gmDataPrefab = (GameObject)Resources.Load(uiTextPrefabPath);

        if (gmDataPrefab != null)
        {
            UnityLog("SpawnGameTextUI -> textState ==== " + textState);
            GameObject obj = (GameObject)Instantiate(gmDataPrefab, uiParent);
            m_TextDtList.Add(new TextDate(textState, obj));
        }
        else
        {
            UnityLogWarning("SpawnGameTextUI -> gmDataPrefab was null, textState ==== " + textState);
        }
    }
Example #3
0
    /// <summary>
    /// 通过文本类型来查找对象.
    /// </summary>
    public TextDate FindGameTextUIByType(GameTextState type)
    {
        TextDate dtFind = m_TextDtList.Find((dt) => { return(dt.m_TextState.Equals(type)); });

        return(dtFind);
    }
Example #4
0
 public TextDate(GameTextState textState, GameObject obj)
 {
     m_TextState  = textState;
     m_GameTextUI = obj;
 }