Пример #1
0
    public void SetInfo(sdFriend friend)
    {
        friInfo = friend;
        if (friInfo == null)
        {
            gameObject.SetActive(false);
            return;
        }

        charName.GetComponent <UILabel>().text        = friend.name;
        petName.GetComponent <UILabel>().text         = friend.petInfo.m_strName + (friend.petInfo.m_iUp == 0?"":"+" + friend.petInfo.m_iUp);
        petFrame.GetComponent <UISprite>().spriteName = sdConfDataMgr.Instance().GetPetQuilityBorder(friend.petInfo.m_iAbility);
        petName.GetComponent <UILabel>().color        = sdConfDataMgr.Instance().GetItemQuilityColor(friend.petInfo.m_iAbility);
        string lvl = string.Format("Lv.{0}", friend.petInfo.m_iLevel);

        petLevel.GetComponent <UILabel>().text       = lvl;
        petIcon.GetComponent <UISprite>().spriteName = friend.petInfo.m_strIcon.ToString();
        if (sdFriendMgr.Instance.GetFriend(friend.id) == null)
        {
            friImg.SetActive(false);
        }
        else
        {
            friImg.SetActive(true);
        }
    }
Пример #2
0
    public Hashtable GetFightList()
    {
        Hashtable table = new Hashtable();
        int       num   = 0;

        foreach (DictionaryEntry item in fightFriList)
        {
            sdFriend fri = item.Value as sdFriend;
            if (fri.isFri && num < 10)
            {
                table.Add(fri.id, fri);
                ++num;
            }
        }

        foreach (DictionaryEntry item in fightFriList)
        {
            sdFriend fri = item.Value as sdFriend;
            if (!fri.isFri && num < 15)
            {
                table.Add(fri.id, fri);
                ++num;
            }
        }

        return(table);
    }
Пример #3
0
    private static void msg_SCID_DONATE_ACTION_POINT_OTHER_NTF(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_DONATE_ACTION_POINT_OTHER_NTF refMSG = (CliProto.SC_DONATE_ACTION_POINT_OTHER_NTF)msg;
        sdFriend fri = sdFriendMgr.Instance.GetFriend(refMSG.m_Info.m_RoleDBID.ToString());

        if (fri != null)
        {
            fri.point = 1;
        }

        sdUICharacter.Instance.RefreshFri();
    }
Пример #4
0
 public bool IsFriend(string strName)
 {
     foreach (DictionaryEntry item in friendList)
     {
         sdFriend friend = item.Value as sdFriend;
         if (friend.name == strName)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #5
0
 public static void msg_SCID_DONATE_ACTION_POINT_ACK(int iMsgID, ref CMessage msg)
 {
     CliProto.SC_DONATE_ACTION_POINT_ACK refMSG = (CliProto.SC_DONATE_ACTION_POINT_ACK)msg;
     if (refMSG.m_Info.m_Result == 1)
     {
         sdFriendMgr.Instance.sendEp++;
         sdFriend fri = sdFriendMgr.Instance.GetFriend(refMSG.m_Info.m_RoleDBID.ToString());
         if (fri != null)
         {
             fri.canSend = false;
             sdUICharacter.Instance.RefreshFri();
         }
     }
 }
Пример #6
0
    void Refresh()
    {
        Hashtable table = sdFriendMgr.Instance.GetFightList();
        int       num   = table.Count;
        List <sdFriPetChooseBtn> btnList = new List <sdFriPetChooseBtn>();

        sdFriPetChooseBtn[] list = GetComponentsInChildren <sdFriPetChooseBtn>();
        foreach (sdFriPetChooseBtn btn in list)
        {
            btnList.Add(btn);
        }
        if (list.Length < 15)
        {
            for (int i = list.Length; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;
                tempItem.transform.parent        = dragPanel.transform;
                tempItem.transform.localPosition = copyItem.transform.localPosition;
                tempItem.transform.localScale    = copyItem.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (120 * i);
                tempItem.transform.localPosition = pos;
                btnList.Add(tempItem.GetComponent <sdFriPetChooseBtn>());
            }
        }

        IEnumerator iter = btnList.GetEnumerator();

        foreach (DictionaryEntry item in table)
        {
            sdFriend info = item.Value as sdFriend;
            if (info == null)
            {
                continue;
            }
            if (iter.MoveNext())
            {
                sdFriPetChooseBtn btn = iter.Current as sdFriPetChooseBtn;
                btn.SetInfo(info);
                btn.gameObject.SetActive(true);
            }
        }

        while (iter.MoveNext())
        {
            sdFriPetChooseBtn btn = iter.Current as sdFriPetChooseBtn;
            btn.SetInfo(null);
        }
    }
Пример #7
0
    public int GetOnlineFriendsNum()
    {
        int ret = 0;

        foreach (DictionaryEntry item in friendList)
        {
            sdFriend friend = item.Value as sdFriend;
            if (friend.isOnline)
            {
                ++ret;
            }
        }

        return(ret);
    }
Пример #8
0
    public Hashtable GetOnlineFriends()
    {
        Hashtable table = new Hashtable();

        foreach (DictionaryEntry item in friendList)
        {
            sdFriend friend = item.Value as sdFriend;
            if (friend.isOnline)
            {
                table.Add(friend.id, friend);
            }
        }

        return(table);
    }
Пример #9
0
 void UpdateEquip(sdFriend roleInfo)
 {
     for (int i = 0; i < euqipSlot.Length; ++i)
     {
         euqipSlot[i].gameObject.transform.FindChild("iconbg").GetComponent <UISprite>().spriteName = "IconFrame1";
     }
     for (int index = 0; index < roleInfo.equipList.Count; ++index)
     {
         uint      templateID = roleInfo.equipList[index];
         Hashtable itemTable  = sdConfDataMgr.Instance().GetItemById(templateID.ToString());
         if (itemTable != null)
         {
             int pos = int.Parse(itemTable["Character"].ToString());
             euqipSlot[pos].SetInfo(templateID.ToString(), sdConfDataMgr.Instance().GetItemById(templateID.ToString()));
         }
     }
 }
Пример #10
0
    public int CompareTo(object obj)
    {
        sdFriend fri = obj as sdFriend;

        if (fri.index > index)
        {
            return(-1);
        }
        else if (fri.index < index)
        {
            return(1);
        }
        else
        {
            return(0);
        }
    }
Пример #11
0
    public static void msg_SCID_FRIEND_INFO_CHANGE_NTF(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_FRIEND_INFO_CHANGE_NTF refMSG = (CliProto.SC_FRIEND_INFO_CHANGE_NTF)msg;

        sdFriend fri = sdFriendMgr.Instance.GetFriend(refMSG.m_Info.m_RoleDBID.ToString());

        if (fri != null)
        {
            if (refMSG.m_Info.m_Info.m_Type == (byte)HeaderProto.RS_ROLE_PROERTY_TYPE.RS_ROLE_PROPERTY_NULL)
            {
                return;
            }
            else if (refMSG.m_Info.m_Info.m_Type == (byte)HeaderProto.RS_ROLE_PROERTY_TYPE.RS_ROLE_PROPERTY_BASE)
            {
                fri.level = refMSG.m_Info.m_Info.m_Property.m_Base.m_Level.ToString();
                fri.power = refMSG.m_Info.m_Info.m_Property.m_Base.m_Attack.ToString();
            }
            else if (refMSG.m_Info.m_Info.m_Type == (byte)HeaderProto.RS_ROLE_PROERTY_TYPE.RS_ROLE_PROPERTY_PET)
            {
                fri.petList.Clear();
                HeaderProto.SRSRolePetData pet = refMSG.m_Info.m_Info.m_Property.m_Pet;
                int petNum = pet.m_Count;
                for (int i = 0; i < petNum; ++i)
                {
                    SClientPetInfo petInfo = new SClientPetInfo();
                    petInfo.m_uiTemplateID = (uint)(pet.m_PetInfo[i].m_TemplateID);
                    fri.petList.Add(petInfo);
                }
            }
            else if (refMSG.m_Info.m_Info.m_Type == (byte)HeaderProto.RS_ROLE_PROERTY_TYPE.RS_ROLE_PROPERTY_EQUIP)
            {
                fri.equipList.Clear();
                int itemNum = refMSG.m_Info.m_Info.m_Property.m_Equip.m_Count;
                for (int i = 0; i < itemNum; ++i)
                {
                    fri.equipList.Add((uint)refMSG.m_Info.m_Info.m_Property.m_Equip.m_EquipInfo[i].m_TID);
                }
            }
            else if (refMSG.m_Info.m_Info.m_Type == (byte)HeaderProto.RS_ROLE_PROERTY_TYPE.RS_ROLE_PROPERTY_ONLINE)
            {
                fri.isOnline = refMSG.m_Info.m_Info.m_Property.m_Online.m_IsOnline == 1 ? true : false;
            }

            sdUICharacter.Instance.RefreshFri();
        }
    }
Пример #12
0
    public void CreateFriend(HeaderProto.SFriendInfo info)
    {
        sdFriend friend = GetFriend(info.m_RoleDBID.ToString());

        if (friend == null)
        {
            friend = new sdFriend();
        }
        friend.id        = info.m_RoleDBID.ToString();
        friend.gender    = info.m_Sex;
        friend.hairStyle = (byte)info.m_Head;
        friend.color     = info.m_SkinColor;
        friend.name      = Encoding.UTF8.GetString(info.m_Name).Trim('\0');
        friend.level     = info.m_Level.ToString();
        friend.job       = info.m_Job.ToString();
        friend.power     = info.m_Attack.ToString();
        friend.isOnline  = info.m_IsOnline == 1 ? true : false;
        friend.point     = (int)info.m_ActionPoint;
        friend.canSend   = info.m_CanDonateActionPoint == 1 ? true : false;
        HeaderProto.SRSRoleEquipData equip = info.m_Equip;
        int itemNum = equip.m_Count;

        for (int i = 0; i < itemNum; ++i)
        {
            friend.equipList.Add((uint)equip.m_EquipInfo[i].m_TID);
        }

        HeaderProto.SRSRolePetData pet = info.m_Pet;
        int petNum = pet.m_Count;

        for (int i = 0; i < petNum; ++i)
        {
            SClientPetInfo petInfo = new SClientPetInfo();
            petInfo.m_uiTemplateID = (uint)(pet.m_PetInfo[i].m_TemplateID);
            friend.petList.Add(petInfo);
        }
        if (friendList.ContainsKey(friend.id))
        {
            friendList[friend.id] = friend;
        }
        else
        {
            friendList.Add(friend.id, friend);
        }
    }
Пример #13
0
    private static void msg_SCID_RECEIVE_ACTION_POINT_ACK(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_RECEIVE_ACTION_POINT_ACK refMSG = (CliProto.SC_RECEIVE_ACTION_POINT_ACK)msg;
        if (refMSG.m_Info.m_Result == 1)
        {
            sdFriendMgr.Instance.getEp++;
            sdFriend fri = sdFriendMgr.Instance.GetFriend(refMSG.m_Info.m_RoleDBID.ToString());
            if (fri != null)
            {
                fri.point = 0;
            }

            string str = string.Format(sdConfDataMgr.Instance().GetShowStr("GetAcPoint"), fri.name);
            sdUICharacter.Instance.ShowOkMsg(str, null);

            sdUICharacter.Instance.RefreshFri();
        }
    }
Пример #14
0
 private static void msg_SC_ROLE_RANK_ACK(int iMsg, ref CMessage msg)
 {
     CliProto.SC_ROLE_RANK_ACK refMsg      = (CliProto.SC_ROLE_RANK_ACK)msg;
     HeaderProto.SRankRoleAck  rankRoleAck = refMsg.m_Ack;
     sdRankListMgr.Instance.m_Count      = rankRoleAck.m_RankCount;
     sdRankListMgr.Instance.m_TotalCount = rankRoleAck.m_TotalCount;
     sdRankListMgr.Instance.m_SelfRank   = rankRoleAck.m_SelfRank;
     sdRankListMgr.Instance.m_Avatar.Clear();
     for (int index = 0; index < rankRoleAck.m_RankCount; ++index)
     {
         HeaderProto.SRoleBaseInfo baseInfo = rankRoleAck.m_Rank[index].m_RoleInfo.m_BaseInfo;
         sdFriend info = new sdFriend();
         info.id        = baseInfo.m_RoleDBID.ToString();
         info.gender    = baseInfo.m_Sex;
         info.hairStyle = (byte)baseInfo.m_HairStyle;
         info.color     = baseInfo.m_SkinColor;
         info.name      = Encoding.UTF8.GetString(baseInfo.m_Name).Trim('\0');
         info.level     = baseInfo.m_Level.ToString();
         info.job       = baseInfo.m_Job.ToString();
         info.power     = baseInfo.m_Attack.ToString();
         info.pvpwin    = baseInfo.m_PVPWins;
         info.pvprepute = baseInfo.m_PVPRepute;
         info.isOnline  = baseInfo.m_IsOnline == 1 ? true : false;
         HeaderProto.SRSRoleEquipData equip = rankRoleAck.m_Rank[index].m_RoleInfo.m_Equip;
         for (int i = 0; i < equip.m_Count; ++i)
         {
             info.equipList.Add((uint)equip.m_EquipInfo[i].m_TID);
         }
         HeaderProto.SRSBattlePets pet = rankRoleAck.m_Rank[index].m_RoleInfo.m_BattlePets;
         for (int j = 0; j < pet.m_Count; ++j)
         {
             SClientPetInfo petInfo = new SClientPetInfo();
             petInfo.m_uiTemplateID = (uint)(pet.m_Pets[j].m_TID);
             petInfo.m_iUp          = pet.m_Pets[j].m_UP;
             petInfo.m_iLevel       = pet.m_Pets[j].m_LV;
             info.petList.Add(petInfo);
         }
         sdRankListMgr.Instance.m_Avatar.Add(info);
     }
     sdRankListMgr.Instance.Refresh();
 }
Пример #15
0
    /* 获取PVP角色信息请求  */
    private static void msg_SC_GET_PVP_ROLE_INFO_ACK(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_GET_PVP_ROLE_INFO_ACK refMsg = (CliProto.SC_GET_PVP_ROLE_INFO_ACK)msg;
        if (refMsg.m_Result != 0)
        {
            return;
        }
        List <stPVPRival> rivalList = sdPVPManager.Instance.GetRanklist();

        if (ms_Index >= 0 && ms_Index < rivalList.Count)
        {
            stPVPRival rival    = rivalList[ms_Index];
            sdFriend   roleInfo = new sdFriend();
            roleInfo.id        = rival.roleID.ToString();
            roleInfo.gender    = (byte)rival.nSex;
            roleInfo.hairStyle = (byte)rival.hairstyle;
            roleInfo.color     = (byte)rival.haircolor;
            roleInfo.name      = rival.strName;
            roleInfo.level     = rival.nLevel.ToString();
            roleInfo.job       = rival.nProfession.ToString();
            roleInfo.power     = refMsg.m_Attack.ToString();

            for (int index = 0; index < refMsg.m_Equip.m_Items.m_ItemCount; ++index)
            {
                roleInfo.equipList.Add((uint)refMsg.m_Equip.m_Items.m_Items[index].m_TID);
            }
            for (int i = 0; i < refMsg.m_Pet.m_PetCount; ++i)
            {
                SClientPetInfo petInfo = new SClientPetInfo();
                petInfo.m_uiTemplateID = refMsg.m_Pet.m_PetsInfo[i].m_TemplateID;
                petInfo.m_iLevel       = refMsg.m_Pet.m_PetsInfo[i].m_Level;
                petInfo.m_iUp          = refMsg.m_Pet.m_PetsInfo[i].m_Up;
                roleInfo.petList.Add(petInfo);
            }
            sdUICharacter.Instance.ShowRoleTipWnd(roleInfo, true, 1);
        }
    }
Пример #16
0
    public void CreateFightFri(CliProto.SAssistBattleInfo info)
    {
        sdFriend fightFri = new sdFriend();

        fightFri.id        = info.m_Assistor.m_Info.m_RoleDBID.ToString();
        fightFri.gender    = info.m_Assistor.m_Info.m_Sex;
        fightFri.hairStyle = (byte)info.m_Assistor.m_Info.m_Head;
        fightFri.color     = info.m_Assistor.m_Info.m_SkinColor;
        fightFri.name      = Encoding.UTF8.GetString(info.m_Assistor.m_Info.m_Name).Trim('\0');
        fightFri.level     = info.m_Assistor.m_Info.m_Level.ToString();
        fightFri.job       = info.m_Assistor.m_Info.m_Job.ToString();
        fightFri.power     = info.m_Assistor.m_Info.m_Attack.ToString();
        fightFri.isOnline  = info.m_Assistor.m_Info.m_IsOnline == 1 ? true : false;
        fightFri.point     = (int)info.m_Assistor.m_Info.m_ActionPoint;
        fightFri.canSend   = info.m_Assistor.m_Info.m_CanDonateActionPoint == 1 ? true : false;
        fightFri.isFri     = info.m_Assistor.m_IsFriend == 1 ? true : false;
        HeaderProto.SRSRoleEquipData equip = info.m_Assistor.m_Info.m_Equip;
        int itemNum = equip.m_Count;

        for (int i = 0; i < itemNum; ++i)
        {
            fightFri.equipList.Add((uint)equip.m_EquipInfo[i].m_TID);
        }

        CliProto.SPetInfo petInfo = info.m_BattlePet;
        if (petInfo != null)
        {
            fightFri.petInfo.m_uuDBID       = petInfo.m_DBID;
            fightFri.petInfo.m_iBattlePos   = petInfo.m_BattlePos;
            fightFri.petInfo.m_uiTemplateID = petInfo.m_TemplateID;
            fightFri.petInfo.m_iLevel       = petInfo.m_Level;
            fightFri.petInfo.m_uuExperience = (UInt64)petInfo.m_Experience;
            fightFri.petInfo.m_iUp          = petInfo.m_Up;
            fightFri.petInfo.m_iHP          = petInfo.m_HP;
            fightFri.petInfo.m_iSP          = petInfo.m_SP;

            fightFri.petInfo.m_CurProperty.m_iStr             = petInfo.m_Str;
            fightFri.petInfo.m_CurProperty.m_iInt             = petInfo.m_Int;
            fightFri.petInfo.m_CurProperty.m_iDex             = petInfo.m_Dex;
            fightFri.petInfo.m_CurProperty.m_iSta             = petInfo.m_Sta;
            fightFri.petInfo.m_CurProperty.m_iFai             = petInfo.m_Fai;
            fightFri.petInfo.m_CurProperty.m_iMaxHP           = petInfo.m_MaxHP;
            fightFri.petInfo.m_CurProperty.m_iMaxSP           = petInfo.m_MaxSP;
            fightFri.petInfo.m_CurProperty.m_iHPTick          = petInfo.m_HPTick;
            fightFri.petInfo.m_CurProperty.m_iSPTick          = petInfo.m_SPTick;
            fightFri.petInfo.m_CurProperty.m_iAtkDmgMin       = petInfo.m_AtkDmgMin;
            fightFri.petInfo.m_CurProperty.m_iAtkDmgMax       = petInfo.m_AtkDmgMax;
            fightFri.petInfo.m_CurProperty.m_iDef             = petInfo.m_Def;
            fightFri.petInfo.m_CurProperty.m_iIceAtt          = petInfo.m_IceAtt;
            fightFri.petInfo.m_CurProperty.m_iFireAtt         = petInfo.m_FireAtt;
            fightFri.petInfo.m_CurProperty.m_iPoisonAtt       = petInfo.m_PoisonAtt;
            fightFri.petInfo.m_CurProperty.m_iThunderAtt      = petInfo.m_ThunderAtt;
            fightFri.petInfo.m_CurProperty.m_iIceDef          = petInfo.m_IceDef;
            fightFri.petInfo.m_CurProperty.m_iFireDef         = petInfo.m_FireDef;
            fightFri.petInfo.m_CurProperty.m_iPoisonDef       = petInfo.m_PoisonDef;
            fightFri.petInfo.m_CurProperty.m_iThunderDef      = petInfo.m_ThunderDef;
            fightFri.petInfo.m_CurProperty.m_iPierce          = petInfo.m_Pierce;
            fightFri.petInfo.m_CurProperty.m_iHit             = petInfo.m_Hit;
            fightFri.petInfo.m_CurProperty.m_iDodge           = petInfo.m_Dodge;
            fightFri.petInfo.m_CurProperty.m_iCri             = petInfo.m_Cri;
            fightFri.petInfo.m_CurProperty.m_iFlex            = petInfo.m_Flex;
            fightFri.petInfo.m_CurProperty.m_iCriDmg          = petInfo.m_CriDmg;
            fightFri.petInfo.m_CurProperty.m_iCriDmgDef       = petInfo.m_CriDmgDef;
            fightFri.petInfo.m_CurProperty.m_iBodySize        = petInfo.m_BodySize;
            fightFri.petInfo.m_CurProperty.m_iAttSize         = petInfo.m_AttSize;
            fightFri.petInfo.m_CurProperty.m_iAttSpeedModPer  = petInfo.m_AttSpeedModPer;
            fightFri.petInfo.m_CurProperty.m_iMoveSpeedModPer = petInfo.m_MoveSpeedModPer;
            fightFri.petInfo.m_CurProperty.m_iPiercePer       = petInfo.m_PiercePer;
            fightFri.petInfo.m_CurProperty.m_iHitPer          = petInfo.m_HitPer;
            fightFri.petInfo.m_CurProperty.m_iDodgePer        = petInfo.m_DodgePer;
            fightFri.petInfo.m_CurProperty.m_iCriPer          = petInfo.m_CriPer;
            fightFri.petInfo.m_CurProperty.m_iFlexPer         = petInfo.m_FlexPer;
            fightFri.petInfo.m_CurProperty.m_iAttSpeed        = petInfo.m_AttSpeed;
            fightFri.petInfo.m_CurProperty.m_iMoveSpeed       = petInfo.m_MoveSpeed;
            uint      uiTemplateID = petInfo.m_TemplateID;
            Hashtable table        = sdConfDataMgr.Instance().GetPetTemplate(uiTemplateID.ToString());
            if (table != null)
            {
                if (table["Name"].ToString() != "")
                {
                    fightFri.petInfo.m_strName = table["Name"].ToString();
                }

                if (table["Ability"].ToString() != "")
                {
                    fightFri.petInfo.m_iAbility = int.Parse(table["Ability"].ToString());
                }

                if (table["BodyType"].ToString() != "")
                {
                    fightFri.petInfo.m_iBodyType = int.Parse(table["BodyType"].ToString());
                }

                if (table["KnockDownDef"].ToString() != "")
                {
                    fightFri.petInfo.m_iKnockDownDef = int.Parse(table["KnockDownDef"].ToString());
                }

                if (table["KnockFlyDef"].ToString() != "")
                {
                    fightFri.petInfo.m_iKnockFlyDef = int.Parse(table["KnockFlyDef"].ToString());
                }

                if (table["KnockBackDef"].ToString() != "")
                {
                    fightFri.petInfo.m_iKnockBackDef = int.Parse(table["KnockBackDef"].ToString());
                }

                if (table["EyeSize"].ToString() != "")
                {
                    fightFri.petInfo.m_iEyeSize = int.Parse(table["EyeSize"].ToString());
                }

                if (table["ChaseSize"].ToString() != "")
                {
                    fightFri.petInfo.m_iChaseSize = int.Parse(table["ChaseSize"].ToString());
                }

                if (table["DfSkill"].ToString() != "")
                {
                    fightFri.petInfo.m_iDfSkill = int.Parse(table["DfSkill"].ToString());
                }

                if (table["SpSkill"].ToString() != "")
                {
                    fightFri.petInfo.m_iSpSkill = int.Parse(table["SpSkill"].ToString());
                }

                if (table["SapSkill"].ToString() != "")
                {
                    fightFri.petInfo.m_iSapSkill = int.Parse(table["SapSkill"].ToString());
                }

                //模板属性aa
                if (table["Property.Str"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iStr = int.Parse(table["Property.Str"].ToString());
                }
                if (table["Property.Int"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iInt = int.Parse(table["Property.Int"].ToString());
                }
                if (table["Property.Dex"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iDex = int.Parse(table["Property.Dex"].ToString());
                }
                if (table["Property.Sta"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iSta = int.Parse(table["Property.Sta"].ToString());
                }
                if (table["Property.Fai"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iFai = int.Parse(table["Property.Fai"].ToString());
                }
                if (table["Property.MaxHP"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iMaxHP = int.Parse(table["Property.MaxHP"].ToString());
                }
                if (table["Property.MaxSP"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iMaxSP = int.Parse(table["Property.MaxSP"].ToString());
                }
                if (table["Property.HPTick"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iHPTick = int.Parse(table["Property.HPTick"].ToString());
                }
                if (table["Property.SPTick"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iSPTick = int.Parse(table["Property.SPTick"].ToString());
                }
                if (table["Property.AtkDmgMin"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iAtkDmgMin = int.Parse(table["Property.AtkDmgMin"].ToString());
                }
                if (table["Property.AtkDmgMax"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iAtkDmgMax = int.Parse(table["Property.AtkDmgMax"].ToString());
                }
                if (table["Property.Def"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iDef = int.Parse(table["Property.Def"].ToString());
                }
                if (table["Property.IceAtt"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iIceAtt = int.Parse(table["Property.IceAtt"].ToString());
                }
                if (table["Property.FireAtt"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iFireAtt = int.Parse(table["Property.FireAtt"].ToString());
                }
                if (table["Property.PoisonAtt"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iPoisonAtt = int.Parse(table["Property.PoisonAtt"].ToString());
                }
                if (table["Property.ThunderAtt"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iThunderAtt = int.Parse(table["Property.ThunderAtt"].ToString());
                }
                if (table["Property.IceDef"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iIceDef = int.Parse(table["Property.IceDef"].ToString());
                }
                if (table["Property.FireDef"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iFireDef = int.Parse(table["Property.FireDef"].ToString());
                }
                if (table["Property.PoisonDef"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iPoisonDef = int.Parse(table["Property.PoisonDef"].ToString());
                }
                if (table["Property.ThunderDef"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iThunderDef = int.Parse(table["Property.ThunderDef"].ToString());
                }
                if (table["Property.Pierce"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iPierce = int.Parse(table["Property.Pierce"].ToString());
                }
                if (table["Property.Hit"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iHit = int.Parse(table["Property.Hit"].ToString());
                }
                if (table["Property.Dodge"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iDodge = int.Parse(table["Property.Dodge"].ToString());
                }
                if (table["Property.Cri"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iCri = int.Parse(table["Property.Cri"].ToString());
                }
                if (table["Property.Flex"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iFlex = int.Parse(table["Property.Flex"].ToString());
                }
                if (table["Property.CriDmg"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iCriDmg = int.Parse(table["Property.CriDmg"].ToString());
                }
                if (table["Property.CriDmgDef"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iCriDmgDef = int.Parse(table["Property.CriDmgDef"].ToString());
                }
                if (table["Property.BodySize"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iBodySize = int.Parse(table["Property.BodySize"].ToString());
                }
                if (table["Property.AttSize"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iAttSize = int.Parse(table["Property.AttSize"].ToString());
                }
                if (table["Property.AttSpeedModPer"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iAttSpeedModPer = int.Parse(table["Property.AttSpeedModPer"].ToString());
                }
                if (table["Property.MoveSpeedModPer"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iMoveSpeedModPer = int.Parse(table["Property.MoveSpeedModPer"].ToString());
                }
                if (table["Property.PiercePer"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iPiercePer = int.Parse(table["Property.PiercePer"].ToString());
                }
                if (table["Property.HitPer"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iHitPer = int.Parse(table["Property.HitPer"].ToString());
                }
                if (table["Property.DodgePer"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iDodgePer = int.Parse(table["Property.DodgePer"].ToString());
                }
                if (table["Property.CriPer"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iCriPer = int.Parse(table["Property.CriPer"].ToString());
                }
                if (table["Property.FlexPer"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iFlexPer = int.Parse(table["Property.FlexPer"].ToString());
                }
                if (table["Property.AttSpeed"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iAttSpeed = int.Parse(table["Property.AttSpeed"].ToString());
                }
                if (table["Property.MoveSpeed"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateProperty.m_iMoveSpeed = int.Parse(table["Property.MoveSpeed"].ToString());
                }
                //属性计算参数aa
                if (table["Coe.AttA"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iAttA = int.Parse(table["Coe.AttA"].ToString());
                }
                if (table["Coe.AttB"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iAttB = int.Parse(table["Coe.AttB"].ToString());
                }
                if (table["Coe.AttC"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iAttC = int.Parse(table["Coe.AttC"].ToString());
                }
                if (table["Coe.DefA"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iDefA = int.Parse(table["Coe.DefA"].ToString());
                }
                if (table["Coe.DefB"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iDefB = int.Parse(table["Coe.DefB"].ToString());
                }
                if (table["Coe.DefC"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iDefC = int.Parse(table["Coe.DefC"].ToString());
                }
                if (table["Coe.HPA"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iHPA = int.Parse(table["Coe.HPA"].ToString());
                }
                if (table["Coe.HPB"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iHPB = int.Parse(table["Coe.HPB"].ToString());
                }
                if (table["Coe.HPC"].ToString() != "")
                {
                    fightFri.petInfo.m_TemplateCoe.m_iHPC = int.Parse(table["Coe.HPC"].ToString());
                }
                //其他信息aa
                if (table["BaseJob"].ToString() != "")
                {
                    fightFri.petInfo.m_iBaseJob = int.Parse(table["BaseJob"].ToString());
                }
                if (table["Desc"].ToString() != "")
                {
                    fightFri.petInfo.m_strDesc = table["Desc"].ToString();
                }
                if (table["SPD1"].ToString() != "")
                {
                    fightFri.petInfo.m_strSPD1 = table["SPD1"].ToString();
                }
                if (table["SPD2"].ToString() != "")
                {
                    fightFri.petInfo.m_strSPD2 = table["SPD2"].ToString();
                }
                if (table["Res"].ToString() != "")
                {
                    fightFri.petInfo.m_strRes = table["Res"].ToString();
                }
                if (table["Skill1"].ToString() != "")
                {
                    fightFri.petInfo.m_iSkill1 = int.Parse(table["Skill1"].ToString());
                }
                if (table["Skill2"].ToString() != "")
                {
                    fightFri.petInfo.m_iSkill2 = int.Parse(table["Skill2"].ToString());
                }
                if (table["Skill3"].ToString() != "")
                {
                    fightFri.petInfo.m_iSkill3 = int.Parse(table["Skill3"].ToString());
                }
                if (table["Skill4"].ToString() != "")
                {
                    fightFri.petInfo.m_iSkill4 = int.Parse(table["Skill4"].ToString());
                }
                if (table["Buff1"].ToString() != "")
                {
                    fightFri.petInfo.m_iBuff1 = int.Parse(table["Buff1"].ToString());
                }
                if (table["Buff2"].ToString() != "")
                {
                    fightFri.petInfo.m_iBuff2 = int.Parse(table["Buff2"].ToString());
                }
                if (table["Buff3"].ToString() != "")
                {
                    fightFri.petInfo.m_iBuff3 = int.Parse(table["Buff3"].ToString());
                }
                if (table["Buff4"].ToString() != "")
                {
                    fightFri.petInfo.m_iBuff4 = int.Parse(table["Buff4"].ToString());
                }
                if (table["AIID"].ToString() != "")
                {
                    fightFri.petInfo.m_iAIID = int.Parse(table["AIID"].ToString());
                }
                if (table["Icon"].ToString() != "")
                {
                    fightFri.petInfo.m_strIcon = table["Icon"].ToString();
                }
            }
            //宠物装备..
            fightFri.petInfo.m_EquipedDB.Clear();
            int count = info.m_BattlePet.m_Equip.m_ItemCount;
            for (int j = 0; j < count; ++j)
            {
                sdGamePetItem item = new sdGamePetItem();
                item.templateID = info.m_BattlePet.m_Equip.m_Items[j].m_TID;
                item.instanceID = info.m_BattlePet.m_Equip.m_Items[j].m_UID;
                item.count      = info.m_BattlePet.m_Equip.m_Items[j].m_CT;
                Hashtable itemInfo = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                if (itemInfo != null)
                {
                    item.mdlPath        = itemInfo["Filename"].ToString();
                    item.mdlPartName    = itemInfo["FilePart"].ToString();
                    item.anchorNodeName = sdGameActor.WeaponDummy(itemInfo["Character"].ToString());
                    item.itemClass      = int.Parse(itemInfo["Class"].ToString());
                    item.subClass       = int.Parse(itemInfo["SubClass"].ToString());
                    item.level          = int.Parse(itemInfo["Level"].ToString());
                    item.quility        = int.Parse(itemInfo["Quility"].ToString());
                }

                fightFri.petInfo.m_EquipedDB[item.instanceID] = item;
            }
        }


        if (fightFriList.ContainsKey(fightFri.id))
        {
            fightFriList[fightFri.id] = fightFri;
        }
        else
        {
            fightFriList.Add(fightFri.id, fightFri);
        }
    }
Пример #17
0
    public void Refresh(sdFriend roleInfo, int nType)
    {
        for (int i = 0; i < btnPanel.Length; ++i)
        {
            btnPanel[i].SetActive(i == nType);
        }
        lb_name.text = roleInfo.name;
        //euqip
        if (UI_avatar != null)
        {
            UI_avatar.transform.localRotation = Quaternion.Euler(0.0f, 180.0f, 0.0f);
            for (int i = 0; i < UI_avatar.transform.childCount; ++i)
            {
                if (UI_avatar.transform.GetChild(i).gameObject != null)
                {
                    GameObject.Destroy(UI_avatar.transform.GetChild(i).gameObject);
                }
            }
            m_kInfo            = new sdGameActorCreateInfo();
            m_kInfo.mDBID      = ulong.Parse(roleInfo.id);
            m_kInfo.mGender    = roleInfo.gender;
            m_kInfo.mHairStyle = roleInfo.hairStyle;
            m_kInfo.mSkinColor = roleInfo.color;
            m_kInfo.mBaseJob   = byte.Parse(roleInfo.job);
            m_kInfo.mJob       = byte.Parse(roleInfo.job);
            m_kInfo.mLevel     = int.Parse(roleInfo.level);

            m_equiplist = roleInfo.equipList.ToArray();

            m_strName = roleInfo.name;
            //lb_power.gameObject.SetActive(int.Parse(roleInfo.power) != 0);
            lb_power.text = "战斗力 " + roleInfo.power;

            string name = "";
            int    job  = int.Parse(roleInfo.job);
            switch (job)
            {
            case (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior:
            {
                name = "warrior";
                break;
            }

            case (int)HeaderProto.ERoleJob.ROLE_JOB_Magic:
            {
                name = "magic";
                break;
            }

            case (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue:
            {
                name = "rogue";
                break;
            }

            case (int)HeaderProto.ERoleJob.ROLE_JOB_Minister:
            {
                name = "minister";
                break;
            }
            }
            ResLoadParams para = new ResLoadParams();
            para.info      = "back";
            para.userdata0 = job;
            para.userdata1 = false;
            string namePreb = string.Format("UI/Icon/$icon_{0}_back/icon_{0}_back.prefab", name);
            sdUICharacter.Instance.LoadAtlas(namePreb, sprite_profession, sdConfDataMgr.Instance().GetJobBack(roleInfo.job));
            UpdateEquip(roleInfo);
        }
        //fashion

        //pet
        int nChildCount = petPanel.transform.childCount;

        for (int index = 0; index < nChildCount; ++index)
        {
            GameObject uiItem = null;
            Transform  trans  = petPanel.transform.FindChild("item" + index.ToString());
            if (trans != null)
            {
                uiItem = trans.gameObject;
            }
            else
            {
                uiItem                         = GameObject.Instantiate(petTemplate) as GameObject;
                uiItem.name                    = "item" + index.ToString();
                uiItem.transform.parent        = petPanel.transform;
                uiItem.transform.localScale    = Vector3.one;
                uiItem.transform.localPosition = new Vector3(petTemplate.transform.localPosition.x, petTemplate.transform.localPosition.y - index * 120, petTemplate.transform.localPosition.z);
                uiItem.transform.localRotation = Quaternion.identity;
            }
            uiItem.SetActive(true);
            Transform  tran_head    = uiItem.transform.FindChild("border").FindChild("head");
            GameObject obj_petName  = uiItem.transform.FindChild("name").gameObject;
            UISprite   sprite_level = uiItem.transform.FindChild("border").GetComponent <UISprite>();

            UILabel lb_power     = uiItem.transform.FindChild("pow").GetComponent <UILabel>();
            UILabel lb_level     = uiItem.transform.FindChild("level").GetComponent <UILabel>();
            UILabel lb_intensify = uiItem.transform.FindChild("intensify").GetComponent <UILabel>();
            if (index < roleInfo.petList.Count)
            {
                SClientPetInfo petInfo = roleInfo.petList[index];
                Hashtable      Info    = sdConfDataMgr.Instance().GetPetTemplate(petInfo.m_uiTemplateID.ToString());
                if (Info == null)
                {
                    continue;
                }
                tran_head.gameObject.SetActive(true);
                sprite_level.gameObject.SetActive(true);
                obj_petName.SetActive(true);
                lb_power.gameObject.SetActive(true);
                lb_level.gameObject.SetActive(true);
                lb_intensify.gameObject.SetActive(true);

                UISprite sprite_head = tran_head.GetComponent <UISprite>();
                sprite_head.spriteName = Info["Icon"].ToString();
                int iAbility = int.Parse(Info["Ability"].ToString());
                sprite_level.spriteName = spritename_level[iAbility - 1];
                sdNewPetMgr.SetLabelColorByAbility(iAbility, obj_petName);
                obj_petName.GetComponent <UILabel>().text = Info["Name"].ToString();

                //星级aaa
                //int parentWidth = sprite_head.width;
                for (int i = 1; i <= 5; ++i)
                {
                    GameObject obj_start = tran_head.FindChild("start" + i.ToString()).gameObject;
                    obj_start.SetActive(true);
                    int nWidth = obj_start.GetComponent <UISprite>().width *iAbility;
                    obj_start.SetActive(i <= iAbility);

                    Vector3 pos = obj_start.transform.localPosition;
                    obj_start.transform.localPosition = new Vector3(-nWidth / 2 + i * 15, pos.y, pos.z);
                }

                lb_power.text     = "战斗力 " + sdConfDataMgr.Instance().GetPetScoreByTemplateID((int)petInfo.m_uiTemplateID, petInfo.m_iUp, petInfo.m_iLevel).ToString();
                lb_level.text     = "等级:" + petInfo.m_iLevel.ToString();
                lb_intensify.text = "强化:+" + petInfo.m_iUp.ToString();
            }
            else
            {
                tran_head.gameObject.SetActive(false);
                sprite_level.gameObject.SetActive(false);
                obj_petName.SetActive(false);
                lb_power.gameObject.SetActive(false);
                lb_level.gameObject.SetActive(false);
                lb_intensify.gameObject.SetActive(false);
                for (int i = 1; i <= 5; ++i)
                {
                    GameObject obj_start = tran_head.FindChild("start" + i.ToString()).gameObject;
                    obj_start.SetActive(false);
                }
            }
        }
        ShowEquip();
        tab_equip.GetComponent <sdRadioButton>().Active(true);
        tab_fashion.GetComponent <sdRadioButton>().Active(false);
        tab_pet.GetComponent <sdRadioButton>().Active(false);
    }
Пример #18
0
    public void RefreshFri(bool needOnline)
    {
        if (friendNum != null)
        {
            int    max    = sdFriendMgr.Instance.GetFriendNum();
            int    online = sdFriendMgr.Instance.GetOnlineFriendsNum();
            string str    = string.Format("{0} {1}/{2}", sdConfDataMgr.Instance().GetShowStr("OnlineFriend"), online, max);
            friendNum.GetComponent <UILabel>().text = str;
        }

        getEpNum.text  = string.Format("{0} / {1}", sdFriendMgr.Instance.getEpMax - sdFriendMgr.Instance.getEp, sdFriendMgr.Instance.getEpMax);
        sendEpNum.text = string.Format("{0} / {1}", sdFriendMgr.Instance.sendEpMax - sdFriendMgr.Instance.sendEp, sdFriendMgr.Instance.sendEpMax);

        Hashtable list = null;

        if (needOnline)
        {
            list = sdFriendMgr.Instance.GetOnlineFriends();
        }
        else
        {
            list = sdFriendMgr.Instance.GetFriends();
        }

        int num   = list.Count;
        int count = friendInfoList.Count;

        if (num > count)
        {
            num = num - count;

            int bgNum = 0;
            for (int i = 0; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(friCopyItem) as GameObject;
                tempItem.GetComponent <sdFriendInfo>().index = count;
                tempItem.transform.parent        = tab_fri.transform;
                tempItem.transform.localPosition = friCopyItem.transform.localPosition;
                tempItem.transform.localScale    = friCopyItem.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (130 * (count / 2));
                if (count % 2 == 0)
                {
                    pos.x = -pos.x;
                }
                tempItem.transform.localPosition = pos;
                friendInfoList.Add(friendInfoList.Count, tempItem.GetComponent <sdFriendInfo>());
                ++count;

                if (bgNum == 0 || bgNum == 3)
                {
                    tempItem.GetComponent <sdFriendInfo>().SetHasBg(true);
                }
                else if (bgNum == 1 || bgNum == 2)
                {
                    tempItem.GetComponent <sdFriendInfo>().SetHasBg(false);
                }

                ++bgNum;
                if (bgNum > 3)
                {
                    bgNum = 0;
                }
            }
        }

        IDictionaryEnumerator iter = friendInfoList.GetEnumerator();

        foreach (DictionaryEntry info in list)
        {
            sdFriend fri = info.Value as sdFriend;
            if (iter.MoveNext())
            {
                sdFriendInfo item = iter.Value as sdFriendInfo;
                item.SetInfo(fri);
            }
        }

        while (iter.MoveNext())
        {
            sdFriendInfo item = iter.Value as sdFriendInfo;
            item.SetInfo(null);
        }
    }
Пример #19
0
    public void RefreshFriRequest()
    {
        int num   = sdFriendMgr.Instance.GetTempFriNum();
        int count = searchList.Count;

        if (num > count)
        {
            num = num - count;
            int bgNum = 0;
            for (int i = 0; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;

                tempItem.GetComponent <sdFriendInfo>().index = count;
                tempItem.transform.parent = addDragPanel.transform;
                tempItem.GetComponent <UIDragPanelContents>().draggablePanel = addDragPanel.GetComponent <UIDraggablePanel>();
                tempItem.transform.localPosition = copyItem.transform.localPosition;
                tempItem.transform.localScale    = copyItem.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (130 * (count));
//              if (count % 2 == 0)
//              {
//                  pos.x = -pos.x;
//              }
                tempItem.transform.localPosition = pos;
                searchList.Add(tempItem.GetComponent <sdFriendInfo>().index, tempItem.GetComponent <sdFriendInfo>());
                ++count;

                if (bgNum == 0 || bgNum == 3)
                {
                    tempItem.GetComponent <sdFriendInfo>().SetHasBg(true);
                }
                else if (bgNum == 1 || bgNum == 2)
                {
                    tempItem.GetComponent <sdFriendInfo>().SetHasBg(false);
                }

                ++bgNum;
                if (bgNum > 3)
                {
                    bgNum = 0;
                }
            }
        }

        IDictionaryEnumerator iter = searchList.GetEnumerator();
        ArrayList             list = new ArrayList(sdFriendMgr.Instance.GetTempFriends().Values);

        list.Sort();
        int maxNum = list.Count;

        for (int i = 0; i < maxNum; ++i)
        {
            sdFriend fri = list[i] as sdFriend;
            if (iter.MoveNext())
            {
                sdFriendInfo item = iter.Value as sdFriendInfo;
                item.SetInfo(fri);
                item.ShowBtn();
            }
        }

        while (iter.MoveNext())
        {
            sdFriendInfo item = iter.Value as sdFriendInfo;
            item.SetInfo(null);
        }
    }
Пример #20
0
    public void SetInfo(CliProto.SC_TREASURE_CHEST_NTF msg)
    {
        LoadScoreEffect(sdUICharacter.Instance.fightScore);
        if (sdUICharacter.Instance.GetBattleType() != (byte)HeaderProto.LEVEL_BATTLE_TYPE.LEVEL_BATTLE_TYPE_ABYSS)
        {
            sdUICharacter.Instance.fightScore = 1;
        }

        if (sdFriendMgr.Instance.fightFriend != null)
        {
            sdFriend fri = sdFriendMgr.Instance.fightFriend;
            friName.GetComponent <UILabel>().text         = fri.name;
            petName.GetComponent <UILabel>().text         = fri.petInfo.m_strName;
            petFrame.GetComponent <UISprite>().spriteName = sdConfDataMgr.Instance().GetPetQuilityBorder(fri.petInfo.m_iAbility);
            UIAtlas atlas = null;
            string  headName;
            //sdConfDataMgr.Instance().SetHeadAtlas += new sdConfDataMgr.HeadAtlas(SetAtlas);
            sdConfDataMgr.Instance().SetHeadPic(fri.gender, fri.hairStyle, fri.color, friIcon.GetComponent <UISprite>());
            //friIcon.GetComponent<UISprite>().atlas = atlas;
            //friIcon.GetComponent<UISprite>().spriteName = headName;

            petIcon.GetComponent <UISprite>().atlas      = sdConfDataMgr.Instance().PetAtlas;
            petIcon.GetComponent <UISprite>().spriteName = fri.petInfo.m_strIcon;
            friLevel.GetComponent <UILabel>().text       = "Lv." + fri.level;
            petLevel.GetComponent <UILabel>().text       = "Lv." + fri.petInfo.m_iLevel.ToString();
        }

        float     expRate            = 1;
        float     moneyRate          = 1;
        Hashtable militarylevelTable = sdConfDataMgr.Instance().GetTable("militarylevel");

        if (militarylevelTable.ContainsKey(sdPVPManager.Instance.nMilitaryLevel.ToString()))
        {
            Hashtable military = militarylevelTable[(sdPVPManager.Instance.nMilitaryLevel).ToString()] as Hashtable;
            expRate   = float.Parse(military["experience"].ToString()) / 100 + 1;
            moneyRate = float.Parse(military["money"].ToString()) / 100 + 1;
        }

        exp   = (int)(((float)msg.m_Experience) * expRate);
        money = (int)(((float)msg.m_Money) * moneyRate);
        Hashtable            table       = sdSlotMgr.Instance.GetIconList(PanelType.Panel_Jiesuan);
        int                  slotNum     = 0;
        int                  num         = (int)msg.m_Items.m_ItemCount;
        List <sdGameItem>    itemList    = new List <sdGameItem>();
        List <sdGamePetItem> petItemList = new List <sdGamePetItem>();
        List <sdGameItem>    petCardList = new List <sdGameItem>();

        for (int i = 0; i < num; ++i)
        {
            sdGameItem item = sdGameItemMgr.Instance.getItem(msg.m_Items.m_Items[i].m_UID);
            if (item == null)
            {
                sdGamePetItem petItem = sdNewPetMgr.Instance.getPetItem(msg.m_Items.m_Items[i].m_UID);
                if (petItem == null)
                {
                    sdGameItem temp = new sdGameItem();
                    temp.templateID = msg.m_Items.m_Items[i].m_TID;
                    Hashtable tempInfo = sdConfDataMgr.Instance().GetItemById(msg.m_Items.m_Items[i].m_TID.ToString());
                    if (tempInfo == null)
                    {
                        continue;
                    }
                    if (int.Parse(tempInfo["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item)
                    {
                        petCardList.Add(temp);
                    }
                    else
                    {
                        itemList.Add(temp);
                    }

                    continue;
                }
                petItemList.Add(petItem);
                continue;
            }
            item.isNew = true;
            itemList.Add(item);
        }

        itemCount = num + msg.m_PetAboutCount;
        num       = msg.m_PetAboutCount;
        for (int i = 0; i < num; ++i)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    Hashtable pet = sdConfDataMgr.Instance().GetItemById(msg.m_PetAbout[i].ToString());
                    if (pet == null)
                    {
                        continue;
                    }
                    if (int.Parse(pet["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Equip)
                    {
                        icon.jiesuanType = JiesuanSlotType.PetItem;
                        icon.SetInfo(msg.m_PetAbout[i].ToString(), pet);
                        icon.gameObject.SetActive(false);
                        icon.GetComponent <BoxCollider>().enabled = true;
                    }
                    else if (int.Parse(pet["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item)
                    {
                        icon.jiesuanType = JiesuanSlotType.Pet;
                        icon.SetInfo(msg.m_PetAbout[i].ToString(), pet);
                        icon.gameObject.SetActive(false);
                        icon.GetComponent <BoxCollider>().enabled = true;
                    }
                }
            }
            ++slotNum;
        }

        foreach (sdGameItem item in petCardList)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    if (item != null)
                    {
                        Hashtable info = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                        icon.panel       = PanelType.Panel_Jiesuan;
                        icon.jiesuanType = JiesuanSlotType.Pet;
                        icon.SetInfo(item.instanceID.ToString(), info);
                        icon.gameObject.SetActive(false);
                    }
                    icon.enable = false;
                    icon.GetComponent <BoxCollider>().enabled = true;
                }
            }
            ++slotNum;
        }

        foreach (sdGamePetItem item in petItemList)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    if (item != null)
                    {
                        Hashtable info = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                        icon.panel       = PanelType.Panel_Jiesuan;
                        icon.jiesuanType = JiesuanSlotType.PetItem;
                        icon.SetInfo(item.instanceID.ToString(), info);
                        icon.gameObject.SetActive(false);
                    }
                    icon.enable = false;
                    icon.GetComponent <BoxCollider>().enabled = true;
                }
            }
            ++slotNum;
        }

        itemList.Sort(CompareItem);

        foreach (sdGameItem item in itemList)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    if (item != null)
                    {
                        Hashtable info = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                        icon.panel = PanelType.Panel_Jiesuan;
                        icon.SetInfo(item.instanceID.ToString(), info);
                        icon.gameObject.SetActive(false);
                    }
                    icon.enable = false;
                    icon.GetComponent <BoxCollider>().enabled = true;
                }
            }
            ++slotNum;
        }

        while (table.ContainsKey(slotNum) && table[slotNum] != null)
        {
            sdSlotIcon icon = table[slotNum] as sdSlotIcon;
            if (icon != null)
            {
                icon.SetInfo("0", null);
                icon.enable = false;
                icon.GetComponent <BoxCollider>().enabled = false;
            }
            ++slotNum;
        }

        int treasureNum = msg.m_GetCount;

        for (int i = 0; i < treasureNum; ++i)
        {
            TreasureInfo info = new TreasureInfo();
            info.index  = msg.m_CardInfos[i].m_IndexID;
            info.id     = (int)msg.m_CardInfos[i].m_ItemID;
            info.count  = (int)msg.m_CardInfos[i].m_Count;
            info.isTemp = false;
            realList.Add(info);
        }

        treasureNum = msg.m_TempCount;
        List <int> ranlist = new List <int>();

        for (int i = 0; i < treasureNum; ++i)
        {
            ranlist.Add(i);
        }

        System.Random ran = new System.Random();
        while (ranlist.Count > 0)
        {
            int          index    = ran.Next(ranlist.Count);
            int          indexNum = ranlist[index];
            TreasureInfo info     = new TreasureInfo();
            info.index  = msg.m_TempCardInfos[indexNum].m_IndexID;
            info.id     = (int)msg.m_TempCardInfos[indexNum].m_ItemID;
            info.count  = (int)msg.m_TempCardInfos[indexNum].m_Count;
            info.isTemp = true;

            tempList.Add(info);

            ranlist.RemoveAt(index);
        }

        if (sdGameLevel.instance != null && sdGameLevel.instance.mainChar != null)
        {
            if (sdGameLevel.instance.mainChar.Property != null)
            {
                curExp  = sdUICharacter.Instance.oldExp;
                m_level = sdUICharacter.Instance.oldLevel;
                m_job   = int.Parse(sdGameLevel.instance.mainChar.Property["Job"].ToString());
                int maxExp = sdConfDataMgr.Instance().GetLevelExp(m_job.ToString(), m_level.ToString());
                if (maxExp == 0)
                {
                    lvMax = true;
                }
                else
                {
                    lvMax = false;
                }

                if (curLevel != null)
                {
                    if (maxExp == 0)
                    {
                        curLevel.GetComponent <UILabel>().text = string.Format("Max");
                    }
                    else
                    {
                        curLevel.GetComponent <UILabel>().text = string.Format("Lv.{0}", m_level.ToString());
                    }
                }

                if (nextLevel != null)
                {
                    if (maxExp == 0)
                    {
                        nextLevel.GetComponent <UILabel>().text = string.Format("");
                    }
                    else
                    {
                        nextLevel.GetComponent <UILabel>().text = string.Format("Lv.{0}", (m_level + 1).ToString());
                    }
                }

                if (lvPic != null)
                {
                    if (maxExp == 0)
                    {
                        lvPic.GetComponent <UISprite>().fillAmount = 0;
                    }
                    else
                    {
                        lvPic.GetComponent <UISprite>().fillAmount = (float)((float)curExp / (float)maxExp);
                    }
                }
            }
        }
    }
Пример #21
0
    public void SetInfo(sdFriend fri)
    {
        if (fri == null)
        {
            gameObject.SetActive(false);
            return;
        }

        btnPanel.SetActive(false);
        addBtn.SetActive(false);
        getAp.SetActive(true);
        sendAp.SetActive(true);

        bool notFriend = (sdFriendMgr.Instance.GetFriend(fri.id) == null);

        gameObject.SetActive(true);
        id = fri.id;
        UIAtlas atlas = null;
        string  headName;

        gender    = fri.gender;
        hairStyle = fri.hairStyle;
        //sdConfDataMgr.Instance().SetHeadAtlas += new sdConfDataMgr.HeadAtlas(SetAtlas);
        sdConfDataMgr.Instance().SetHeadPic(fri.gender, fri.hairStyle, fri.color, img.GetComponent <UISprite>());

        strName = fri.name;
        if (img != null)
        {
            //if (atlas != null)
            //{
            //    img.GetComponent<UISprite>().atlas = atlas;
            //}
            //img.GetComponent<UISprite>().spriteName = headName;

            if (fri.isOnline)
            {
                img.GetComponent <UISprite>().color = Color.white;
            }
            else
            {
                img.GetComponent <UISprite>().color = Color.grey;
            }
        }


        if (level != null)
        {
            level.GetComponent <UILabel>().text = string.Format("Lv.{0}", fri.level);
        }

        if (job != null)
        {
            job.GetComponent <UILabel>().text = sdConfDataMgr.Instance().GetJobName(fri.job);
        }

        if (name != null)
        {
            name.GetComponent <UILabel>().text = fri.name;
        }

        if (power != null)
        {
            power.GetComponent <UILabel>().text = string.Format("{0} {1}", sdConfDataMgr.Instance().GetShowStr("Score"), fri.power);
        }


        if (sdFriendMgr.Instance.GetFriend(fri.id) == null)
        {
            addBtn.SetActive(true);
        }
        else
        {
            addBtn.SetActive(false);
        }

        if (fri.point > 0 && (sdFriendMgr.Instance.getEpMax > sdFriendMgr.Instance.getEp))
        {
            getAp.GetComponent <UIButton>().enabled = true;
            if (getAp.transform.GetChild(0) != null && getAp.transform.GetChild(0).GetComponent <UISprite>() != null)
            {
                getAp.transform.GetChild(0).GetComponent <UISprite>().alpha = 1f;
            }
        }
        else
        {
            getAp.GetComponent <UIButton>().enabled = false;
            if (getAp.transform.GetChild(0) != null && getAp.transform.GetChild(0).GetComponent <UISprite>() != null)
            {
                getAp.transform.GetChild(0).GetComponent <UISprite>().alpha = 0.5f;
            }
        }

        if (fri.canSend && (sdFriendMgr.Instance.sendEpMax > sdFriendMgr.Instance.sendEp))
        {
            sendAp.GetComponent <UIButton>().enabled = true;
            if (sendAp.transform.GetChild(0) != null && sendAp.transform.GetChild(0).GetComponent <UISprite>() != null)
            {
                sendAp.transform.GetChild(0).GetComponent <UISprite>().alpha = 1f;
            }
        }
        else
        {
            sendAp.GetComponent <UIButton>().enabled = false;
            if (sendAp.transform.GetChild(0) != null && sendAp.transform.GetChild(0).GetComponent <UISprite>() != null)
            {
                sendAp.transform.GetChild(0).GetComponent <UISprite>().alpha = 0.5f;
            }
        }
    }
Пример #22
0
    public void ShowFriInfo()
    {
        if (friinfo != null)
        {
            sdFriend fri = sdFriendMgr.Instance.GetFriend(sdUICharacter.Instance.GetCurFriId());
            if (fri == null)
            {
                fri = sdFriendMgr.Instance.GetTempFriend(sdUICharacter.Instance.GetCurFriId());
            }
            if (fri == null)
            {
                return;
            }
            friinfo.SetActive(true);
            petAvatar.SetActive(false);
            if (avatar != null)
            {
                sdGameActorCreateInfo kInfo = new sdGameActorCreateInfo();
                kInfo.mDBID      = 1;
                kInfo.mGender    = fri.gender;
                kInfo.mHairStyle = fri.hairStyle;
                kInfo.mSkinColor = fri.color;
                kInfo.mBaseJob   = byte.Parse(fri.job);
                kInfo.mJob       = byte.Parse(fri.job);
                kInfo.mLevel     = int.Parse(fri.level);
                avatar.AddComponent <sdFriAvatar>();
                avatar.GetComponent <sdFriAvatar>().init(kInfo);
                uint[] equiplist = fri.equipList.ToArray();
                avatar.GetComponent <sdFriAvatar>().updateAvatar(equiplist, (uint)fri.equipList.Count);
                avatar.GetComponent <sdFriAvatar>().PlayIdle();
                avatar.GetComponent <SpinObject>().m_Target = avatar.GetComponent <sdFriAvatar>();
                avatar.GetComponent <SpinObject>().m_Speed  = 0.5f;

                int maxNum = fri.petList.Count;
                int i      = 0;
                for (; i < maxNum; ++i)
                {
                    petList[i].SetInfo(fri.petList[i].m_uiTemplateID.ToString());
                }

                maxNum = sdNewPetMgr.Instance.BattlePetNum;
                for (; i < maxNum; ++i)
                {
                    petList[i].SetInfo("");
                }

                needJobBack = true;
                baseJob     = int.Parse(fri.job);
                sdConfDataMgr.Instance().LoadJobAtlas(baseJob);
            }

            if (friendName != null)
            {
                friendName.GetComponent <UILabel>().text = fri.name;
            }

            if (power != null)
            {
                power.GetComponent <UILabel>().text = sdConfDataMgr.Instance().GetShowStr("Score") + fri.power;
            }
        }
    }
Пример #23
0
    public void Refresh()
    {
        if (panel == null)
        {
            return;
        }
        UpdateBtnSprite();
        List <sdFriend> pklist      = sdRankListMgr.Instance.m_Avatar;
        int             nChildCount = panel.transform.childCount;
        int             index       = 0;

        if (sdRankListMgr.Instance.m_SelfRank == -1)
        {
            lb_selfRank.text = "10000名之后";
        }
        else
        {
            lb_selfRank.text = (sdRankListMgr.Instance.m_SelfRank + 1).ToString();
        }
        lstjobAtlas.Clear();
        for (; index < sdRankListMgr.Instance.m_Count; ++index)
        {
            sdFriend   roleInfo  = pklist[index];
            GameObject uiItem    = null;
            Transform  tranChild = panel.transform.FindChild("item" + index.ToString());
            if (tranChild != null)
            {
                uiItem = tranChild.gameObject;
            }
            else
            {
                uiItem                         = GameObject.Instantiate(item) as GameObject;
                uiItem.name                    = "item" + index.ToString();
                uiItem.transform.parent        = panel.transform;
                uiItem.transform.localScale    = Vector3.one;
                uiItem.transform.localPosition = new Vector3(item.transform.localPosition.x, item.transform.localPosition.y - index * 100, item.transform.localPosition.z);
                uiItem.transform.localRotation = Quaternion.identity;
            }
            uiItem.SetActive(true);

            GameObject spriterank_obj = uiItem.transform.FindChild("Sprite_rank").gameObject;
            GameObject lbrank_ojb     = uiItem.transform.FindChild("ranking").gameObject;

            spriterank_obj.SetActive(true);
            UISprite spriterank = spriterank_obj.GetComponent <UISprite>();
            if (index == 0)
            {
                spriterank.spriteName = "h";
            }
            else if (index == 1)
            {
                spriterank.spriteName = "hu";
            }
            else if (index == 2)
            {
                spriterank.spriteName = "l";
            }
            else
            {
                spriterank_obj.SetActive(false);
            }
            lbrank_ojb.SetActive(true);
            UILabel lbrank = lbrank_ojb.GetComponent <UILabel>();
            lbrank.text = (index + 1).ToString();
            UILabel lbname = uiItem.transform.FindChild("name").GetComponent <UILabel>();
            lbname.text = roleInfo.name;

            UILabel lbpkvalue = uiItem.transform.FindChild("pkvalue").GetComponent <UILabel>();
            switch (sdRankListMgr.Instance.rankType)
            {
            case HeaderProto.ERankType.RANKTYPE_ATTACK:
                lbpkvalue.text = roleInfo.power.ToString();
                break;

            case HeaderProto.ERankType.RANKTYPE_LEVEL:
                lbpkvalue.text = roleInfo.level;
                break;

            case HeaderProto.ERankType.RANKTYPE_PVPREPUTE:
                lbpkvalue.text = roleInfo.pvprepute.ToString();
                break;

            case HeaderProto.ERankType.RANKTYPE_PVPWINS:
                lbpkvalue.text = roleInfo.pvpwin.ToString();
                break;
            }


            //UILabel lbprofession = uiItem.transform.FindChild("profession").GetComponent<UILabel>();
            string str = sdConfDataMgr.Instance().GetProfessionText(int.Parse(roleInfo.job));
            //lbprofession.text = sdConfDataMgr.Instance().GetProfessionText(int.Parse(roleInfo.job));
            UISprite spriteprofession = uiItem.transform.FindChild("Sprite_profession").GetComponent <UISprite>();
            UIAtlas  jobAtlas         = sdConfDataMgr.Instance().GetAtlas(roleInfo.job);
            if (jobAtlas != null)
            {
                spriteprofession.atlas = jobAtlas;
            }
            else
            {
                sdConfDataMgr.Instance().LoadJobAtlas(int.Parse(roleInfo.job));
                JobAtlasInfo item = new JobAtlasInfo();
                item.jobname = roleInfo.job;
                item.sprite  = spriteprofession;
                lstjobAtlas.Add(item);
            }
            spriteprofession.spriteName = sdConfDataMgr.Instance().GetJobIcon(roleInfo.job);
        }
        //多余的隐藏aaa
        for (; index < nChildCount; ++index)
        {
            panel.transform.FindChild("item" + index.ToString()).gameObject.SetActive(false);
        }
    }