public void UpdateFellowInfo(Fellow fellow, bool bState = true)  //bState true 出战  false 召回
    {
        if (fellow == null)
        {
            return;
        }

        if (fellow.IsValid() == false)
        {
            return;
        }
        cloningArea.SetActive(false);
        normalArea.SetActive(true);

        UpdateFellowInfo_Attr(fellow);
        UpdateFellowInfo_Star(fellow);
        UpdateFellowInfo_Skill(fellow);
        if (bState)
        {
            UpdateFellowInfo_Model(fellow);
        }
        UpdateFellowInfo_Button(fellow);

        m_Fellow = fellow;
    }
Exemplo n.º 2
0
    public void OnFellowClick(Fellow fellow)
    {
        m_clickFellow = fellow;
        if (fellow == null)
        {
            // cloning item
            if (m_CurTab == TABCONTENT.TABCONTENT_INFO)
            {
                if (m_PartnerFrameLogic_Info != null)
                {
                    m_PartnerFrameLogic_Info.ShowCloningTips();
                }
                mCurFellowId = GlobeVar.INVALID_GUID;
                PartnerFrameItemLogic[] bItem = m_PartnerListGrid.GetComponentsInChildren <PartnerFrameItemLogic>();
                for (int i = 0; i < bItem.Length; ++i)
                {
                    bItem[i].UpdateChooseFlag(mCurFellowId);
                }
            }
            return;
        }

        if (false == fellow.IsValid())
        {
            return;
        }
        mCurFellowId = fellow.Guid;
        PartnerFrameItemLogic[] aItem = m_PartnerListGrid.GetComponentsInChildren <PartnerFrameItemLogic>();
        for (int i = 0; i < aItem.Length; ++i)
        {
            aItem[i].UpdateChooseFlag(fellow.Guid);
        }

        if (m_CurTab == TABCONTENT.TABCONTENT_INFO)
        {
            if (m_PartnerFrameLogic_Info != null)
            {
                m_PartnerFrameLogic_Info.UpdateFellowInfo(fellow);
                if (fellow.GetFellowType() == (int)FELLOWTYPE.BABY && GameManager.gameManager.MissionManager.IsHaveMission(MISSION_ID_BABY_UPGRADE))
                {
                    NewPlayerGuide(21);
                }
            }
        }
        else if (m_CurTab == TABCONTENT.TABCONTENT_DEVELOP)
        {
            if (m_PartnerFrameLogic_Develop != null)
            {
                m_PartnerFrameLogic_Develop.UpdateFellowInfo(fellow);
            }
        }
        else if (m_CurTab == TABCONTENT.TABCONTENT_SKILL)
        {
            if (m_PartnerFrameLogic_Skill != null)
            {
                m_PartnerFrameLogic_Skill.UpdateFellowInfo(fellow);
            }
        }
        OnItemClick(fellow);
    }
    public void UpdateFellowInfo(Fellow fellow)
    {
        if (fellow == null)
        {
            return;
        }

        if (fellow.IsValid() == false)
        {
            return;
        }
        m_LevelUpSkillChooseBuffer = GlobeVar.INVALID_ID;
        m_SkillInfo.SetActive(true);
        m_SkillChooseWindow.SetActive(false);
        m_LevelUpWindowType = LEVELUP_WINDOWTYPE.TYPE_INVALID;

        UpdateFellowInfo_TalentSkill(fellow);
        UpdateFellowInfo_ElementSkill(fellow);

        m_Fellow = fellow;
        if (sendPackageCallback != null)
        {
            sendPackageCallback();
            sendPackageCallback = null;
        }
    }
Exemplo n.º 4
0
    public void UpdateFellowInfo_Refresh()
    {
        if (m_Fellow == null || m_Fellow.IsValid() == false)
        {
            return;
        }

        UpdateFellowInfo_Attr(m_Fellow);
        UpdateFellowInfo_Model(m_Fellow);
        UpdateFellowInfo_Tab(m_Fellow);
    }
Exemplo n.º 5
0
    public void UpdateFellowInfo_Refresh()
    {
        if (m_fellow == null || false == m_fellow.IsValid())
        {
            return;
        }

        SetName(m_fellow);
        SetLevel(m_fellow);
        SetIcon(m_fellow);
        SetLock(m_fellow);
        SetQuality(m_fellow);
        SetFellowType(m_fellow);
    }
    void InitMaterialPartnerGrid()
    {
        Utils.CleanGrid(m_MaterialPartnerGrid);

        // 先加载个加宠物按钮 靠前显示
        if (false == CreateAddMaterialBtn())
        {
            return;
        }

        //m_MaterialPartnerLabel.SetActive(m_ChoosePartnerGuid.Count <= 0);

        FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container == null)
        {
            return;
        }

        for (int i = 0; i < m_ChoosePartnerGuid.Count; i++)
        {
            if (m_ChoosePartnerGuid[i] == GlobeVar.INVALID_GUID)
            {
                break;
            }

            Fellow fellow = container.GetFellowByGuid(m_ChoosePartnerGuid[i]);
            if (fellow == null || false == fellow.IsValid() || fellow.Guid == m_Fellow.Guid || fellow.Locked)
            {
                break;
            }

            string     objectName   = i + 1 < 10 ? "0" + (i + 1).ToString() : (i + 1).ToString();
            GameObject fellowobject = Utils.BindObjToParent(m_MaterialPartnerItem, m_MaterialPartnerGrid, objectName);
            if (fellowobject == null || fellowobject.GetComponent <MaterialPartnerItemLogic>() == null)
            {
                break;
            }

            fellowobject.GetComponent <MaterialPartnerItemLogic>().Init(fellow);
        }

        if (m_MaterialPartnerGrid.GetComponent <UIGrid>() != null)
        {
            m_MaterialPartnerGrid.GetComponent <UIGrid>().Reposition();
        }

        //UpdateFellowInfo_NextStar(m_Fellow, m_ChoosePartnerExp);
    }
Exemplo n.º 7
0
    public void OnChangeNameClick(Fellow fellow)
    {
        if (fellow == null)
        {
            return;
        }

        if (false == fellow.IsValid())
        {
            return;
        }

        m_ChangeNameWindow.SetActive(true);

        m_FellowBuffer = fellow;
    }
Exemplo n.º 8
0
    private List <Data> GetDataListFellow_3()
    {
        List <Data> res = new List <Data>();

        FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container == null)
        {
            return(res);
        }

        List <Fellow> babylist = new List <Fellow>();
//        int nFellowCount = container.GetFellowCount();
        List <Fellow> fellowList = FellowTool.FellowSort(container);

        if (M_OPEN_TYPE == OPEN_TYPE.NORMAL)
        {
            for (int i = 0; i < fellowList.Count; ++i)
            {
                //有效槽位
                Fellow fellow = fellowList[i];
                if (fellow.IsValid())
                {
                    babylist.Add(fellow);
                }
            }
        }
        else if (M_OPEN_TYPE == OPEN_TYPE.PROPAGATE)
        {
            babylist = FellowTool.FellowCanBreedingFilter(container);
        }


        if (babylist.Count <= 0)
        {
            return(res);
        }

        for (int i = 0; i < babylist.Count; i++)
        {
            Data data = new Data();
            data.guid = babylist[i].Guid;
            res.Add(data);
        }
        return(res);
    }
Exemplo n.º 9
0
    public void UpdateFellowInfo(Fellow fellow)
    {
        if (fellow == null)
        {
            return;
        }

        if (fellow.IsValid() == false)
        {
            return;
        }

        UpdateFellowInfo_Attr(fellow);
        UpdateFellowInfo_Model(fellow);
        UpdateFellowInfo_Tab(fellow);

        m_Fellow = fellow;
    }
Exemplo n.º 10
0
    public void UpdateFellowInfo(Fellow fellow)
    {
        if (fellow == null || false == fellow.IsValid())
        {
            return;
        }

        normalInfo.SetActive(true);
        cloningInfo.SetActive(false);
        RedPoint.SetActive(false);
        SetName(fellow);
        SetLevel(fellow);
        SetIcon(fellow);
        SetLock(fellow);
        SetQuality(fellow);
        SetFellowType(fellow);

        m_fellow = fellow;
    }
Exemplo n.º 11
0
    public void RefreshPartnerList(Predicate <Fellow> filter = null)
    {
        if (m_PartnerListGrid != null)
        {
            //先清空
            Utils.CleanGrid(m_PartnerListGrid);

            m_PartnerList.SetActive(true);

            FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;
            if (container == null)
            {
                return;
            }
            //遍历伙伴容器
            List <Fellow> fellowList = FellowTool.FellowSort(container);
            for (int i = 0; i < fellowList.Count; ++i)
            {
                //有效槽位
                Fellow fellow = fellowList[i];
                if (fellow.IsValid())
                {
                    if (filter != null && !filter(fellow))
                    {
                        continue;
                    }
                    string objectName = "";
                    if (i < 10)
                    {
                        objectName += "0";
                    }
                    objectName += i.ToString();
                    GameObject fellowobject = Utils.BindObjToParent(m_PartnerListItem, m_PartnerListGrid, objectName);
                    if (fellowobject != null && fellowobject.GetComponent <PartnerFrameItemLogic>() != null)
                    {
                        fellowobject.GetComponent <PartnerFrameItemLogic>().UpdateFellowInfo(fellow);
                    }
                }
            }
            m_PartnerListGrid.GetComponent <UIGrid>().Reposition();
            ShowSelectFun();            //升星后列表的选中
        }
    }
    static void OnShowFellowTip(bool bSuccess, object param)
    {
        if (!bSuccess)
        {
            return;
        }

        Fellow fellow = param as Fellow;

        if (fellow == null || false == fellow.IsValid())
        {
            return;
        }

        if (ChatInfoLinkFellowTipLogic.Instance() != null)
        {
            ChatInfoLinkFellowTipLogic.Instance().SetMyFellow(fellow);
        }
    }
Exemplo n.º 13
0
    public void UpdateFellowInfo(Fellow fellow)
    {
        if (fellow == null)
        {
            return;
        }

        if (fellow.IsValid() == false)
        {
            return;
        }

        m_AttackLabel.text   = fellow.GetAttackValue().ToString();
        m_HitLabel.text      = fellow.GetHitValue().ToString();
        m_CriticalLabel.text = fellow.GetCriticalValue().ToString();
        m_GuardLabel.text    = fellow.GetGuardValue().ToString();
        m_BlessLabel.text    = fellow.GetBlessValue().ToString();

        m_AttackLabelNext.text   = StrDictionary.GetClientDictionaryString("#{11202}", fellow.GetAttackValueByStar(fellow.StarLevel + 1) - fellow.GetAttackValue());
        m_HitLabelNext.text      = StrDictionary.GetClientDictionaryString("#{11202}", fellow.GetHitValueByStar(fellow.StarLevel + 1) - fellow.GetHitValue());
        m_CriticalLabelNext.text = StrDictionary.GetClientDictionaryString("#{11202}", fellow.GetCriticalValueByStar(fellow.StarLevel + 1) - fellow.GetCriticalValue());
        m_GuardLabelNext.text    = StrDictionary.GetClientDictionaryString("#{11202}", fellow.GetGuardValueByStar(fellow.StarLevel + 1) - fellow.GetGuardValue());
        m_BlessLabelNext.text    = StrDictionary.GetClientDictionaryString("#{11202}", fellow.GetBlessValueByStar(fellow.StarLevel + 1) - fellow.GetBlessValue());

        if (fellow.GetFellowType() == (int)FELLOWTYPE.BABY)
        {
            m_StarAttr.SetActive(false);
            //m_BabyFellowNotice.SetActive(true);
        }
        else
        {
            UpdateFellowInfo_CurStar(fellow);
            //UpdateFellowInfo_NextStar(fellow, 0);
            UpdateFellowInfo_Material();

            m_StarAttr.SetActive(true);
            //m_BabyFellowNotice.SetActive(false);
        }

        m_Fellow = fellow;
    }
Exemplo n.º 14
0
    public void OnRebirthClick(Fellow fellow)
    {
        if (fellow == null)
        {
            return;
        }

        if (false == fellow.IsValid())
        {
            return;
        }

        Tab_CabalFellowAttr tabAttr = TableManager.GetCabalFellowAttrByID(fellow.DataId, 0);

        if (tabAttr == null)
        {
            return;
        }

        Tab_CabalFellowAttr tabBaby = TableManager.GetCabalFellowAttrByID(tabAttr.BabyFellowId, 0);

        if (tabBaby == null)
        {
            LogModule.ErrorLog("The fellow has not baby state, fellow id = " + fellow.DataId);
            return;
        }

        m_CurFellowIcon.spriteName         = fellow.GetIcon();
        m_CurFellowQualityFrame.spriteName = FellowTool.GetFellowQualityFrame(fellow.Quality);
        m_CurFellowNameLabel.text          = fellow.Name;
        m_RebirthFellowIcon.spriteName     = tabBaby.Icon;
        m_RebirthFellowNameLabel.text      = tabBaby.Name;
        m_RebirthItemSlot.InitInfo_Yuanbao(null, GlobeVar.PARTNER_REBIRTH_YUANBAO.ToString(), true);

        m_RebirthWindow.SetActive(true);

        m_FellowBuffer = fellow;
    }
Exemplo n.º 15
0
    void UpdateChooseFellowInfo(bool forward)
    {
        FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container == null)
        {
            return;
        }

        List <Fellow> babylist = FellowTool.FellowCanBreedingFilter(container);

        if (babylist.Count <= 0)
        {
            return;
        }

        Fellow updatefellow = null;

        if (forward)
        {
            for (int i = (m_FellowIndexBuffer + 1) % babylist.Count; i < babylist.Count; i++)
            {
                Fellow fellow = babylist[i];
                if (false == fellow.IsValid())
                {
                    continue;
                }

                if (m_BabyFellowBuffer == null)
                {
                    updatefellow        = fellow;
                    m_FellowIndexBuffer = i;
                    break;
                }
                else
                {
                    if (fellow.Guid != m_BabyFellowBuffer.Guid)
                    {
                        updatefellow        = fellow;
                        m_FellowIndexBuffer = i;
                        break;
                    }
                }
            }
        }
        else
        {
            for (int i = (m_FellowIndexBuffer + babylist.Count - 1) % babylist.Count; i >= 0; i--)
            {
                Fellow fellow = babylist[i];
                if (false == fellow.IsValid())
                {
                    continue;
                }

                if (m_BabyFellowBuffer == null)
                {
                    updatefellow        = fellow;
                    m_FellowIndexBuffer = i;
                    break;
                }
                else
                {
                    if (fellow.Guid != m_BabyFellowBuffer.Guid)
                    {
                        updatefellow        = fellow;
                        m_FellowIndexBuffer = i;
                        break;
                    }
                }
            }
        }

        if (updatefellow == null || false == updatefellow.IsValid() || false == updatefellow.IsBabyFellow())
        {
            return;
        }

//         m_PartnerChooseIcon.spriteName = updatefellow.GetIcon();
//         m_PartnerChooseNameLabel.text = updatefellow.Name;
//         m_PartnerChooseLevelLabel.text = "LV" + updatefellow.Level.ToString();
//         m_PartnerChooseCombatValueLabel.text = updatefellow.GetCombatValue().ToString();
//         m_PartnerChooseProcreateLabel.text = updatefellow.ProcreateCount.ToString();
//         m_PartnerChooseLuckyLabel.text = updatefellow.Lucky.ToString();

        m_BabyFellowBuffer = updatefellow;
    }
Exemplo n.º 16
0
    public void InitPartnerList(UInt64 defaultGuid = GlobeVar.INVALID_GUID, Predicate <Fellow> filter = null)
    {
        if (m_PartnerListGrid != null)
        {
            //先清空
            Utils.CleanGrid(m_PartnerListGrid);

            m_PartnerList.SetActive(true);

            FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;
            if (container == null)
            {
                return;
            }
            //遍历伙伴容器
            bool                  bFirst         = true;
            List <Fellow>         fellowList     = FellowTool.FellowSort(container);
            PartnerFrameItemLogic firstOneCache  = null;
            bool                  needReSelect   = false;
            bool                  needToTopReset = false;
            int firstOneCacheIndex = 0;
            for (int i = 0; i < fellowList.Count; ++i)
            {
                //有效槽位
                Fellow fellow = fellowList[i];
                if (fellow.IsValid())
                {
                    if (filter != null && !filter(fellow))
                    {
                        if (firstOneCache == null)
                        {
                            firstOneCacheIndex += 1;
                        }
                        if (fellow.Guid == defaultGuid)
                        {
                            needReSelect = true;
                        }
                        continue;
                    }
                    string objectName = "";
                    if (i < 10)
                    {
                        objectName += "0";
                    }
                    objectName += i.ToString();
                    GameObject fellowobject = Utils.BindObjToParent(m_PartnerListItem, m_PartnerListGrid, objectName);
                    if (fellowobject != null && fellowobject.GetComponent <PartnerFrameItemLogic>() != null)
                    {
                        fellowobject.GetComponent <PartnerFrameItemLogic>().UpdateFellowInfo(fellow);
                        if (i == firstOneCacheIndex)
                        {
                            firstOneCache = fellowobject.GetComponent <PartnerFrameItemLogic>();
                        }
                        if (defaultGuid == GlobeVar.INVALID_GUID)
                        {
                            if (bFirst)
                            {
                                fellowobject.GetComponent <PartnerFrameItemLogic>().OnFellowClick();
                                bFirst         = false;
                                needToTopReset = true;
                            }
                        }
                        else
                        {
                            if (fellow.Guid == defaultGuid)
                            {
                                fellowobject.GetComponent <PartnerFrameItemLogic>().OnFellowClick();
                            }
                        }
                    }
                }
            }

            if (needReSelect && firstOneCache != null)
            {
                needToTopReset = true;
                firstOneCache.OnFellowClick();
            }

            // add cloning fellow in info view
            if (filter == null && GameManager.gameManager.PlayerDataPool.IsProcreateGoing())
            {
                GameObject fellowobject = Utils.BindObjToParent(m_PartnerListItem, m_PartnerListGrid, "z00");
                if (fellowobject != null && fellowobject.GetComponent <PartnerFrameItemLogic>() != null)
                {
                    fellowobject.GetComponent <PartnerFrameItemLogic>().ShowCloningInfo();
                    if (fellowList.Count == 0)
                    {
                        fellowobject.GetComponent <PartnerFrameItemLogic>().OnFellowClick();
                    }
                }
            }

            m_PartnerListGrid.GetComponent <UIGrid>().Reposition();
            if (needToTopReset)
            {
                m_PartnerListGrid.GetComponent <UITopGrid>().Recenter(true);
            }
            m_PartnerCapacity.text = container.GetCapacityStr();
        }
        UpdateFellowTip();
    }
Exemplo n.º 17
0
    public int GetPartnerSkillCanLevelUpCount()
    {
        //遍历伙伴容器
        FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container == null)
        {
            return(0);
        }
        List <Fellow> fellowlist = FellowTool.FellowSort(container);

        for (int i = 0; i < fellowlist.Count; ++i)
        {
            Fellow fellow = fellowlist[i];
            if (fellow.IsValid())
            {
                //天赋技能
                foreach (KeyValuePair <int, int> pair in fellow.TallentSkill)
                {
                    if (pair.Key != GlobeVar.INVALID_ID)
                    {
                        int talentSkillId = pair.Key;
                        Tab_CabalFellowTallentSkill tabTalentSkill = TableManager.GetCabalFellowTallentSkillByID(talentSkillId, 0);
                        if (tabTalentSkill == null)
                        {
                            return(0);
                        }
                        int needTalentBookId = tabTalentSkill.SkillBook;
                        if (tabTalentSkill.NextSkillId != GlobeVar.INVALID_ID)
                        {
                            if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(needTalentBookId) > 0)
                            {
                                return(1);
                            }
                        }
                        else
                        {
                            return(0);
                        }
                    }
                }
                //培养技能
                for (int j = 0; j < Fellow.FELLOW_ELEMENTSKILL_COUNT; j++)
                {
                    int fellowElementSkillId = fellow.GetElementSkillId(i);
                    int fellowLevel          = fellow.Level;
                    int index = j;
                    if (fellowElementSkillId == GlobeVar.INVALID_ID)//空位还没有开启的话
                    {
                        if (index < 0 || index >= Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length)
                        {
                            return(0);
                        }
                        if (fellowLevel == Fellow.FELLOW_ELEMENTSKILL_LEVELNEED[index])
                        {
                            return(0);
                        }
                    }
                    else //开启了
                    {
                        Tab_CabalFellowElementSkill tabSkill = TableManager.GetCabalFellowElementSkillByID(fellowElementSkillId, 0);
                        if (tabSkill == null)
                        {
                            return(0);
                        }
                        Tab_CabalFellowElementSkill tabNextSkill = TableManager.GetCabalFellowElementSkillByID(tabSkill.NextSkillId, 0);
                        {
                            if (tabNextSkill == null)
                            {
                                return(0);
                            }
                            else
                            {
                                int packHaveBookNum      = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(tabNextSkill.NeedBookId);
                                int nextSkillNeedBookNum = tabNextSkill.NeedBookCount;
                                if (packHaveBookNum >= nextSkillNeedBookNum)
                                {
                                    return(1);
                                }
                            }
                        }
                    }
                }
            }
        }

        return(0);
    }
Exemplo n.º 18
0
    /// <summary>
    /// 自动筛选宠物
    /// </summary>
    /// <param name="quality"></param>
    void InitMaterialPartnerGrid_Auto(int quality)
    {
        Utils.CleanGrid(m_ChooseMaterialGrid);
        m_ChoosePartnerGuid.Clear();
        m_ChoosePartnerExp = 0;
        FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container == null)
        {
            return;
        }

        //遍历伙伴容器
        List <Fellow> fellowList   = FellowTool.FellowSort(container);
        bool          gotFTEFellow = false;

        for (int i = 0; i < fellowList.Count; ++i)
        {
            //有效槽位
            Fellow fellow = fellowList[i];
            if (false == fellow.IsValid() || fellow.Guid == m_Fellow.Guid || fellow.Locked)
            {
                continue;
            }

            string objectName = string.Empty;
            if (!gotFTEFellow && PartnerFrameLogic.Instance().NewPlayerGuideFlag_Step == 16 && fellow.DataId == 41)// 宠物升星引导狗粮宠
            {
                gotFTEFellow = true;
                objectName   = "a" + fellow.DataId;
            }
            else
            {
                objectName = "b" + i;
            }

            GameObject fellowobject = Utils.BindObjToParent(m_MaterialPartnerItem, m_ChooseMaterialGrid, objectName);
            var        logic        = fellowobject.GetComponent <MaterialPartnerItemLogic>();
            if (fellowobject == null || logic == null)
            {
                continue;
            }

            logic.Init(fellow);
            if (fellow.Quality < quality)
            {
                logic.Choose = true;
                m_ChoosePartnerGuid.Add(fellow.Guid);
                m_ChoosePartnerExp += logic.StarExp;
            }
        }

        if (fellowList.Count < FELLOW_PACK_DEFAULT_NUM)
        {
            for (int i = fellowList.Count; i <= FELLOW_PACK_DEFAULT_NUM; i++)
            {
                string objectName = "c" + i;
                Utils.BindObjToParent(m_MaterialPartnerItem, m_ChooseMaterialGrid, objectName);
            }
        }

        UIHexagonGrid grid = m_ChooseMaterialGrid.GetComponent <UIHexagonGrid>();

        if (grid != null)
        {
            grid.sorted = true;
            grid.Reposition();
        }

        int nTotalStarExp = m_ChoosePartnerExp + m_Fellow.StarExp;

        m_ChooseMaterialExpSprite.fillAmount = (float)nTotalStarExp / (float)m_Fellow.GetCurStarExpMax();

        int addLevel = FellowTool.GetFellowAddStarLevel(m_Fellow.StarLevel, nTotalStarExp);

        if (addLevel > 0)
        {
            m_ChooseMaterialExpCount.gameObject.SetActive(true);
            m_ChooseMaterialExpCount.text = "x" + addLevel.ToString();
        }
        else
        {
            m_ChooseMaterialExpCount.gameObject.SetActive(false);
        }
    }
Exemplo n.º 19
0
    void OnClickSaveName()
    {
        if (m_FellowBuffer == null)
        {
            //未选择伙伴
            GUIData.AddNotifyData2Client(false, "#{1836}");
            return;
        }

        if (false == m_FellowBuffer.IsValid())
        {
            return;
        }

        if (string.IsNullOrEmpty(m_ChangeNameInput.value))
        {
            //请输入伙伴名称
            GUIData.AddNotifyData2Client(false, "#{1837}");
            return;
        }

        int curCharNum = 0;     // 英文算一个,中文算两个

        foreach (char curChar in m_ChangeNameInput.value)
        {
            if ((int)curChar >= 128)
            {
                curCharNum += 2;
            }
            else if ((int)curChar >= 65 && (int)curChar <= 90)
            {
                curCharNum += 2;
            }
            else
            {
                curCharNum += 1;
            }
        }
        if (curCharNum > 14)
        {
            // 名字过长
            GUIData.AddNotifyData2Client(false, "#{1279}");
            return;
        }

        if (m_ChangeNameInput.value.Contains("*"))
        {
            GUIData.AddNotifyData2Client(false, "#{1278}");
            return;
        }

        if (null == Utils.GetStrFilter(m_ChangeNameInput.value, (int)Games.GlobeDefine.GameDefine_Globe.STRFILTER_TYPE.STRFILTER_NAME))
        {
            CG_FELLOW_CHANGE_NAME fellowPak = (CG_FELLOW_CHANGE_NAME)PacketDistributed.CreatePacket(MessageID.PACKET_CG_FELLOW_CHANGE_NAME);
            fellowPak.SetFellowguid(m_FellowBuffer.Guid);
            fellowPak.SetName(m_ChangeNameInput.value);
            fellowPak.SendPacket();

            OnClickCloseChangeName();
        }
        else
        {
            // 包含非法字符
            GUIData.AddNotifyData2Client(false, "#{1278}");
        }
    }