Ejemplo n.º 1
0
    void OnSelectRole(int index)
    {
//         if (m_iCurIndex == index)
//         {
//             return;
//         }
        GameCmd.SelectUserInfo userInfo = GetRoleInfoByIndex(index);

        bool havePre = m_iCurIndex != -1;

        if (havePre)
        {
            if (null != m_rightDesTA)
            {
                m_rightDesTA.ResetToBeginning();
                m_rightDesTA.Play(true);
            }
            GameCmd.SelectUserInfo pre = GetRoleInfoByIndex(m_iCurIndex);
            if (pre != null)
            {
                GetRoleGridByIndex(m_iCurIndex).SetSelect(false);
                GetDesObjByPro(pre.type).SetActive(false);
            }
        }
        GetRoleGridByIndex(index).SetSelect(true, havePre);
        GetDesObjByPro(userInfo.type).SetActive(true);
        m_iPreIndex = m_iCurIndex;
        m_iCurIndex = index;
        ChooseRole(userInfo);
    }
Ejemplo n.º 2
0
    void onClick_DeleteRoleBtn_Btn(GameObject caster)
    {
        GameCmd.SelectUserInfo info = GetRoleInfoByIndex(m_iCurIndex);
        if (info == null)
        {
            return;
        }

        string      des      = "";
        uint        limitLv  = GameTableManager.Instance.GetGlobalConfig <uint>("DelCharStayMinLevel");
        bool        matchLv  = info.level >= limitLv;
        bool        matchNum = lstRoleList.Count > 1;
        TextManager Tmger    = DataManager.Manager <TextManager>();

        //一个角色不能删除
        if (!matchNum)
        {
            des = Tmger.GetLocalText(LocalTextType.DeleteRole_Tips_4);
            TipsManager.Instance.ShowTipWindow(TipWindowType.Ok, des, null);
            return;
        }
        if (info.del == 1)
        {
            des = Tmger.GetLocalText(LocalTextType.Login_Server_InDelete);
            TipsManager.Instance.ShowTipWindow(TipWindowType.Ok, des, null);
            return;
        }
        //小于30  不可恢复
        if (!matchLv)
        {
            des = Tmger.GetLocalFormatText(LocalTextType.DeleteRole_Tips_1, info.name);
        }
        else
        {
            uint remainHours = GameTableManager.Instance.GetGlobalConfig <uint>("DelCharStayTime");
            des = Tmger.GetLocalFormatText(LocalTextType.DeleteRole_Tips_2, info.name, remainHours, remainHours);
        }

        Action yes = delegate
        {
            if (!matchLv)
            {
                m_iCurIndex = -1;
                m_iPreIndex = -1;
            }
            stDeleteSelectUserCmd cmd = new stDeleteSelectUserCmd()
            {
                charid = info.id
            };
            NetService.Instance.Send(cmd);
        };

        TipsManager.Instance.ShowTipWindow(TipWindowType.YesNO, des, yes, null, title: Tmger.GetLocalText(LocalTextType.Local_TXT_Tips), okstr: Tmger.GetLocalText(LocalTextType.Local_TXT_Confirm), cancleStr: Tmger.GetLocalText(LocalTextType.Local_TXT_Cancel));
    }
Ejemplo n.º 3
0
    public void SetData(int index, GameCmd.SelectUserInfo info = null)
    {
        m_iIndex = index;
        m_uID    = (null != info) ? info.id : 0;
        m_info   = info;
        if (null != m_collider && m_collider.enabled == Empty)
        {
            m_collider.enabled = !Empty;
        }
        if (null != m_tsNone && null != m_tsNone.GetComponent <Collider>())
        {
            m_tsNone.GetComponent <Collider>().enabled = Empty;
        }
        //if (null != m_tsNone)
        //{
        //    if (m_tsNone.gameObject.activeSelf != Empty)
        //        m_tsNone.gameObject.SetActive(Empty);
        //    if (null != m_collider && m_collider.enabled)
        //    {
        //        m_collider.enabled = false;
        //    }
        //}
        if (m_labLeftTime != null)
        {
            if (info != null)
            {
                bool inDelete = info.del == 1;
                m_labLeftTime.gameObject.SetActive(inDelete);
                if (inDelete)
                {
                    m_labLeftTime.text = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.DeleteRole_Tips_5, GetTime(info.delleveltime));
                }
            }
        }
        if (null != m_tsCharacterInfo)
        {
            if (m_tsCharacterInfo.gameObject.activeSelf == Empty)
            {
                m_tsCharacterInfo.gameObject.SetActive(!Empty);
            }
            if (!Empty)
            {
                if (null != m_labLv)
                {
                    m_labLv.text = string.Format("{0}级", info.level);
                }

                if (null != m_labName)
                {
                    m_labName.text = info.name;
                }
                if (null != m_spCIcon)
                {
                    if (m_spCIcon.mSpriteCount == 2)
                    {
                        m_spCIcon.mSpriteList = new string[2];

                        string strIcon = ChooseRolePanel.GetSpriteName(info.type);
                        m_spCIcon.mSpriteList[0] = strIcon;
                        m_spCIcon.mSpriteList[1] = strIcon + "_hui";
                        m_spCIcon.Reset();
                    }
                }
            }
        }
        SetSelect(false, false);
    }