示例#1
0
    static public int PetItemSortByColor(sdGamePetItem item, sdGamePetItem compare)
    {
        int scoreCompare = sdConfDataMgr.Instance().GetItemScore(compare.templateID.ToString(), 0);
        int scoreItem    = sdConfDataMgr.Instance().GetItemScore(item.templateID.ToString(), 0);

        if (compare.quility > item.quility)
        {
            return(1);
        }
        else if (compare.quility < item.quility)
        {
            return(-1);
        }
        else
        {
            if (scoreCompare > scoreItem)
            {
                return(1);
            }
            else if (scoreCompare < scoreItem)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
    }
示例#2
0
    void OnClick()
    {
        if (gameObject)
        {
            //换装备界面武器防具等,同时只能选中一件..
            if (bSelect == false && equipUID != UInt64.MaxValue)
            {
                sdGamePetItem petItem = sdNewPetMgr.Instance.getPetItem(equipUID);
                if (petItem != null)
                {
                    GameObject wnd = sdGameLevel.instance.NGUIRoot;
                    if (wnd)
                    {
                        sdUIPetChangeEquipPnl cePnl = wnd.GetComponentInChildren <sdUIPetChangeEquipPnl>();
                        if (cePnl)
                        {
                            cePnl.SetAllItemUnSelectByCharacter(petItem.iCharacter);
                        }
                    }
                }
            }

            bSelect = !bSelect;
            ReflashSelectUI();
        }
    }
 public void SetAllItemUnSelectByCharacter(int iCharacter)
 {
     foreach (DictionaryEntry info in petItemList)
     {
         sdUIPetEquipIcon icon = info.Value as sdUIPetEquipIcon;
         UInt64           uuID = icon.GetId();
         if (uuID != UInt64.MaxValue)
         {
             sdGamePetItem petItem = sdNewPetMgr.Instance.getPetItem(uuID);
             if (petItem != null && petItem.iCharacter == iCharacter)
             {
                 icon.bSelect = false;
                 icon.ReflashSelectUI();
             }
         }
     }
 }
示例#4
0
    public void RefreshPetItemListPage()
    {
        if (copyItem == null)
        {
            return;
        }

        Hashtable list = null;

        list = sdNewPetMgr.Instance.getAllPetItemByCharacter((int)m_Type);

        //将宠物装备数据填充到List中,用来排序..
        List <sdGamePetItem> listEquip = new List <sdGamePetItem>();

        foreach (DictionaryEntry info in list)
        {
            sdGamePetItem info1 = info.Value as sdGamePetItem;
            listEquip.Add(info1);
        }
        if (m_iSortType == (int)PetItemSortType.PetItem_SortBy_Value)
        {
            listEquip.Sort(sdGamePetItem.PetItemSortByValue);
        }
        else if (m_iSortType == (int)PetItemSortType.PetItem_SortBy_Color)
        {
            listEquip.Sort(sdGamePetItem.PetItemSortByColor);
        }

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

        if (num > count)
        {
            num = num - count;
            for (int i = 0; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;
                tempItem.GetComponent <sdUIPetEquipIcon>().index = count;
                tempItem.transform.parent        = copyItem.transform.parent;
                tempItem.transform.localPosition = copyItem.transform.localPosition;
                tempItem.transform.localScale    = copyItem.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (114 * (count / 3));
                int iX = (count % 3) * 400;
                pos.x += iX;
                tempItem.transform.localPosition = pos;
                tempItem.GetComponent <sdUIPetEquipIcon>().bSelect = false;
                petItemList.Add(petItemList.Count, tempItem.GetComponent <sdUIPetEquipIcon>());
                ++count;
            }
        }

        IDictionaryEnumerator iter = petItemList.GetEnumerator();

        foreach (sdGamePetItem infoEntry in listEquip)
        {
            if (iter.MoveNext())
            {
                sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
                icon.SetIdAndReflashUI(infoEntry.instanceID);
            }
        }

        while (iter.MoveNext())
        {
            sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
            icon.SetIdAndReflashUI(UInt64.MaxValue);
        }
    }
示例#5
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);
        }
    }
示例#6
0
    public void SetIdAndReflashUI(UInt64 id)
    {
        if (id == UInt64.MaxValue)
        {
            equipUID = UInt64.MaxValue;
            gameObject.SetActive(false);
            hasAtlas = false;
            iconId   = -1;
            strIcon  = "";

            if (iconbg)
            {
                iconbg.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = 0;
            }

            return;
        }

        if (iconbg)
        {
            iconbg.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = 0;
        }

        gameObject.SetActive(true);
        equipUID = id;
        bSelect  = false;
        ReflashSelectUI();

        Color         PetEquipColor0 = new Color(214f / 255f, 214f / 255f, 214f / 255f, 1f);
        Color         PetEquipColor1 = new Color(45f / 255f, 210f / 255f, 18f / 255f, 1f);
        Color         PetEquipColor2 = new Color(0f, 144f / 255f, 1f, 1f);
        Color         PetEquipColor3 = new Color(164f / 255f, 84f / 255f, 254f / 255f, 1f);
        Color         PetEquipColor4 = new Color(1f, 179f / 255f, 15f / 255f, 1f);
        sdGamePetItem petItem        = sdNewPetMgr.Instance.getPetItem(equipUID);

        if (petItem != null)
        {
            Hashtable info = sdConfDataMgr.Instance().GetItemById(petItem.templateID.ToString());
            if (info != null)
            {
                iconId  = int.Parse(info["IconID"].ToString());
                strIcon = info["IconPath"].ToString();
                if (iconId >= 0)
                {
                    sdConfDataMgr.Instance().LoadItemAtlas(iconId.ToString(), OnSetAtlas);
//					hasAtlas = false;
//					UIAtlas atlas = sdConfDataMgr.Instance().GetItemAtlas(iconId.ToString());
//					if (atlas!=null&&icon!=null)
//					{
//						icon.GetComponent<UISprite>().atlas = atlas;
//						icon.GetComponent<UISprite>().spriteName = strIcon;
//					}
                }

                string strName  = info["ShowName"].ToString();
                int    iQuility = int.Parse(info["Quility"].ToString());
                if (lb_name)
                {
                    if (iQuility == 1)
                    {
                        lb_name.GetComponent <UILabel>().color = PetEquipColor0;
                    }
                    else if (iQuility == 2)
                    {
                        lb_name.GetComponent <UILabel>().color = PetEquipColor1;
                    }
                    else if (iQuility == 3)
                    {
                        lb_name.GetComponent <UILabel>().color = PetEquipColor2;
                    }
                    else if (iQuility == 4)
                    {
                        lb_name.GetComponent <UILabel>().color = PetEquipColor3;
                    }
                    else if (iQuility == 5)
                    {
                        lb_name.GetComponent <UILabel>().color = PetEquipColor4;
                    }
                    else
                    {
                        lb_name.GetComponent <UILabel>().color = PetEquipColor0;
                    }

                    lb_name.GetComponent <UILabel>().text = strName;
                }

                int score = sdConfDataMgr.Instance().GetItemScore(petItem.templateID.ToString(), 0);
                if (lb_point != null)
                {
                    string txt = string.Format("{0} {1}", sdConfDataMgr.Instance().GetShowStr("Score"), score.ToString());
                    lb_point.GetComponent <UILabel>().text = txt;
                }

                if (iconbg)
                {
                    iconbg.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = petItem.templateID;
                }
            }
        }
    }
    void OnClick()
    {
        if (gameObject.name == "BT_petClose")
        {
            if (sdUIPetControl.m_UIPetChangeEquipPnl != null)
            {
                sdUIPetControl.Instance.ClosePetPnl(sdUIPetControl.m_UIPetChangeEquipPnl);
            }

            if (m_preWnd)
            {
                m_preWnd.SetActive(true);
            }

            GameObject wnd = GameObject.Find("NGUIRoot");
            if (wnd)
            {
                sdUIPetPropPnl petPnl = wnd.GetComponentInChildren <sdUIPetPropPnl>();
                if (petPnl)
                {
                    petPnl.SetPetModelVisible(true);
                }
            }
        }
        else if (gameObject.name == "btnEquip")
        {
            GameObject wnd = GameObject.Find("NGUIRoot");
            if (wnd)
            {
                sdUIPetChangeEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetChangeEquipPnl>();
                if (petPnl)
                {
                    foreach (DictionaryEntry info in petPnl.petItemList)
                    {
                        sdUIPetEquipIcon icon = info.Value as sdUIPetEquipIcon;
                        if (icon != null)
                        {
                            UInt64 uuID = icon.GetId();
                            if (uuID != UInt64.MaxValue && icon.bSelect == true)
                            {
                                sdPetMsg.Send_CS_PET_EQUIP_REQ(uuID, petPnl.m_uuSelectDBID, 1);
                            }
                        }
                    }
                }
            }
        }
        else if (gameObject.name == "btnUnEquip")
        {
            GameObject wnd = GameObject.Find("NGUIRoot");
            if (wnd)
            {
                sdUIPetChangeEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetChangeEquipPnl>();
                if (petPnl)
                {
                    SClientPetInfo Info = null;
                    if (petPnl.m_uuSelectDBID != UInt64.MaxValue)
                    {
                        Info = sdNewPetMgr.Instance.GetPetInfo(petPnl.m_uuSelectDBID);
                        if (Info == null)
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }

                    foreach (DictionaryEntry equipInfo in Info.m_EquipedDB)
                    {
                        sdGamePetItem petItem = (sdGamePetItem)equipInfo.Value;
                        UInt64        uuID    = petItem.instanceID;
                        if (uuID != UInt64.MaxValue)
                        {
                            sdPetMsg.Send_CS_PET_EQUIP_REQ(uuID, petPnl.m_uuSelectDBID, 0);
                        }
                    }
                }
            }
        }
    }
    public void RefreshPetItemListPage()
    {
        Hashtable list = null;

        list = sdNewPetMgr.Instance.petItemDB;

        //将宠物装备数据填充到List中,用来排序..
        List <sdGamePetItem> listEquip1 = new List <sdGamePetItem>();
        List <sdGamePetItem> listEquip2 = new List <sdGamePetItem>();

        foreach (DictionaryEntry info in list)
        {
            sdGamePetItem item = info.Value as sdGamePetItem;
            if (item.iCharacter == m_iSortSubClass || m_iSortSubClass == (int)PetEquipType.Pet_EquipType_all)
            {
                listEquip1.Add(item);
            }
            else if (item.iCharacter != m_iSortSubClass && m_iSortSubClass != (int)PetEquipType.Pet_EquipType_all)
            {
                listEquip2.Add(item);
            }
        }
        listEquip1.Sort(sdGamePetItem.PetItemSortByValue);
        listEquip2.Sort(sdGamePetItem.PetItemSortByValue);

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

        if (num > count)
        {
            num = num - count;
            for (int i = 0; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;
                tempItem.GetComponent <sdUIPetEquipIcon>().index = count;
                tempItem.transform.parent        = copyItem.transform.parent;
                tempItem.transform.localPosition = copyItem.transform.localPosition;
                tempItem.transform.localScale    = copyItem.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (114 * (count / 2));
                int iX = (count % 2) * 400;
                pos.x += iX;
                tempItem.transform.localPosition = pos;
                tempItem.GetComponent <sdUIPetEquipIcon>().bSelect = false;
                petItemList.Add(petItemList.Count, tempItem.GetComponent <sdUIPetEquipIcon>());
                ++count;
            }
        }

        IDictionaryEnumerator iter = petItemList.GetEnumerator();

        foreach (sdGamePetItem infoEntry in listEquip1)
        {
            if (iter.MoveNext())
            {
                sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
                icon.SetIdAndReflashUI(infoEntry.instanceID);
            }
        }

        foreach (sdGamePetItem infoEntry in listEquip2)
        {
            if (iter.MoveNext())
            {
                sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
                icon.SetIdAndReflashUI(infoEntry.instanceID);
            }
        }

        while (iter.MoveNext())
        {
            sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
            icon.SetIdAndReflashUI(UInt64.MaxValue);
        }

        if (copyItem != null)
        {
            copyItem.transform.parent.GetComponent <UIDraggablePanel>().ResetPosition();
        }
    }
    public void ReflashPetEquipUI()
    {
        if (equip0)
        {
            equip0.SetActive(false);
        }

        if (equip1)
        {
            equip1.SetActive(false);
        }

        if (equip2)
        {
            equip2.SetActive(false);
        }

        if (equipK0)
        {
            equipK0.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = 0;
        }

        if (equipK1)
        {
            equipK1.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = 0;
        }

        if (equipK2)
        {
            equipK2.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = 0;
        }

        if (m_uuSelectDBID == UInt64.MaxValue)
        {
            return;
        }
        SClientPetInfo Info = sdNewPetMgr.Instance.GetPetInfo(m_uuSelectDBID);

        if (Info == null)
        {
            return;
        }

        foreach (DictionaryEntry equipInfo in Info.m_EquipedDB)
        {
            sdGamePetItem petItem = (sdGamePetItem)equipInfo.Value;
            Hashtable     info    = sdConfDataMgr.Instance().GetItemById(petItem.templateID.ToString());
            if (info != null)
            {
                int    isubClass = int.Parse(info["SubClass"].ToString());
                int    iconId    = int.Parse(info["IconID"].ToString());
                string strIcon   = info["IconPath"].ToString();
                if (iconId >= 0)
                {
                    UIAtlas atlas = sdConfDataMgr.Instance().GetItemAtlas(iconId.ToString());
                    if (atlas != null)
                    {
                        if (isubClass == (int)PetEquipType.Pet_EquipType_fj)
                        {
                            if (equip0)
                            {
                                equip0.GetComponent <UISprite>().atlas      = atlas;
                                equip0.GetComponent <UISprite>().spriteName = strIcon;
                                equip0.SetActive(true);

                                if (equipK0)
                                {
                                    equipK0.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = petItem.templateID;
                                }
                            }
                        }
                        else if (isubClass == (int)PetEquipType.Pet_EquipType_wq)
                        {
                            if (equip1)
                            {
                                equip1.GetComponent <UISprite>().atlas      = atlas;
                                equip1.GetComponent <UISprite>().spriteName = strIcon;
                                equip1.SetActive(true);

                                if (equipK1)
                                {
                                    equipK1.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = petItem.templateID;
                                }
                            }
                        }
                        else if (isubClass == (int)PetEquipType.Pet_EquipType_sp)
                        {
                            if (equip2)
                            {
                                equip2.GetComponent <UISprite>().atlas      = atlas;
                                equip2.GetComponent <UISprite>().spriteName = strIcon;
                                equip2.SetActive(true);

                                if (equipK2)
                                {
                                    equipK2.GetComponent <sdUIPetEquipButtonClick>().m_iEquipID = petItem.templateID;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
示例#10
0
    public void SetInfo(CliProto.SC_TREASURE_CHEST_NTF msg)
    {
        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;
        }

        int exp   = (int)(((float)msg.m_Experience) * expRate);
        int money = (int)(((float)msg.m_Money) * moneyRate);

        expLbl.text   = exp.ToString();
        moneyLbl.text = moneyLbl.ToString();

        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;
            }
            itemList.Add(item);
        }

        num = msg.m_PetAboutCount;
        for (int i = 0; i < num; ++i)
        {
            if (table.Length > slotNum && table[slotNum] != null)
            {
                sdSweepResultIcon icon = table[slotNum];
                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.SetInfo(msg.m_PetAbout[i]);
                    }
                    else if (int.Parse(pet["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item)
                    {
                        icon.SetInfo(msg.m_PetAbout[i]);
                    }
                }
            }
            ++slotNum;
        }

        foreach (sdGameItem item in petCardList)
        {
            if (table.Length > slotNum && table[slotNum] != null)
            {
                sdSweepResultIcon icon = table[slotNum];
                if (icon != null)
                {
                    if (item != null)
                    {
                        icon.SetInfo(item.instanceID);
                    }
                }
            }
            ++slotNum;
        }

        foreach (sdGamePetItem item in petItemList)
        {
            if (table.Length > slotNum && table[slotNum] != null)
            {
                sdSweepResultIcon icon = table[slotNum];
                if (icon != null)
                {
                    if (item != null)
                    {
                        icon.SetInfo(item.instanceID);
                    }
                }
            }
            ++slotNum;
        }

        //itemList.Sort(CompareItem);

        foreach (sdGameItem item in itemList)
        {
            if (table.Length > slotNum && table[slotNum] != null)
            {
                sdSweepResultIcon icon = table[slotNum];
                if (icon != null)
                {
                    if (item != null)
                    {
                        icon.SetInfo(item.instanceID);
                    }
                }
            }
            ++slotNum;
        }

        while (table.Length > slotNum && table[slotNum] != null)
        {
            sdSweepResultIcon icon = table[slotNum];
            if (icon != null)
            {
                icon.SetInfo(0);
            }
            ++slotNum;
        }

        int treasureNum = msg.m_GetCount;

        for (int i = 0; i < treasureNum; ++i)
        {
            sdSweepResultIcon icon = table[4];
            icon.SetInfo(msg.m_CardInfos[i].m_ItemID);
        }
    }
示例#11
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);
                    }
                }
            }
        }
    }
示例#12
0
    void OnClick()
    {
        if (panel == PanelType.Panel_ItemUp)
        {
            if (index == 0)
            {
                sdUICharacter.Instance.ShowItemSelectWnd(SelectType.ItemUpChange);
                sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(sdUICharacter.Instance.OnChangeUpItem));
                return;
            }
            else if (index == -1)
            {
                return;
            }

            if (sdGameItemMgr.Instance.upItem == null)
            {
                sdUICharacter.Instance.ShowMsgLine(sdConfDataMgr.Instance().GetShowStr("SelectUpItem"), Color.yellow);
                return;
            }

            sdUICharacter.Instance.ShowItemSelectWnd(SelectType.ItemUp);
            sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(sdUICharacter.Instance.GetItemUpWnd().OnSelectItemOk));
            return;
        }
        else if (panel == PanelType.Panel_ItemMake)
        {
            if (index == 0)
            {
                sdUICharacter.Instance.ShowItemSelectWnd(SelectType.ItemMake);
                sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(sdUICharacter.Instance.GetItemUpWnd().SelectItemMake));
                return;
            }
            else
            {
                sdUICharacter.Instance.ShowTip(TipType.TempItem, tempId);
                return;
            }
        }
        else if (panel == PanelType.Panel_GemReplace)
        {
            if (itemid != "0" && itemid != "")
            {
                if (sdGameItemMgr.Instance.selGemList.ContainsKey(itemid))
                {
                    int num = sdGameItemMgr.Instance.selGemList[itemid];
                    if (num == 1)
                    {
                        sdGameItemMgr.Instance.selGemList.Remove(itemid);
                    }
                    else
                    {
                        sdGameItemMgr.Instance.selGemList[itemid]--;
                    }
                }
                SetInfo("0", null);
                return;
            }

            sdUICharacter.Instance.ShowItemSelectWnd(SelectType.GemReplace);
            //sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(sdUICharacter.Instance.GetItemUpWnd().OnSelectGemReplace));
            sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(OnSelectGemReplace));
            return;
        }
        else if (panel == PanelType.Panel_GemMerge)
        {
            if (index > 2)
            {
                return;
            }
            if (itemid != "0" && itemid != "")
            {
                if (sdGameItemMgr.Instance.selGemList.ContainsKey(itemid))
                {
                    int num = sdGameItemMgr.Instance.selGemList[itemid];
                    if (num == 1)
                    {
                        sdGameItemMgr.Instance.selGemList.Remove(itemid);
                    }
                    else
                    {
                        sdGameItemMgr.Instance.selGemList[itemid]--;
                    }
                }
                SetInfo("0", null);
                return;
            }
            sdUICharacter.Instance.ShowItemSelectWnd(SelectType.GemMerge);
            sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(SelectGemMerge));
            return;
        }
        else if (panel == PanelType.Panel_GemSet)
        {
            if (index > 2)
            {
                return;
            }
            if (sdGameItemMgr.Instance.upItem == null)
            {
                sdUICharacter.Instance.ShowMsgLine(sdConfDataMgr.Instance().GetShowStr("SelectGemItem"), Color.yellow);
                return;
            }
            if (itemid == "-1")
            {
                sdUICharacter.Instance.ShowMsgLine(sdConfDataMgr.Instance().GetShowStr("GemOnError1"), Color.yellow);
                return;
            }
            if (itemid != "0" && itemid != "")
            {
                //sdGameItem item = sdGameItemMgr.Instance.getItem(ulong.Parse(itemid));
                Hashtable          info      = sdConfDataMgr.Instance().GetItemById(tempId);
                Hashtable          gemInfo   = sdConfDataMgr.Instance().GetGemLevel(info["Level"].ToString());
                string             needMoney = gemInfo["HoleOffMoney"].ToString();
                sdMsgBox.OnConfirm ok        = new sdMsgBox.OnConfirm(OnGemOff);
                sdUICharacter.Instance.ShowOkCanelMsg(string.Format(sdConfDataMgr.Instance().GetShowStr("GemOffConfirm"), needMoney), ok, null);
                return;
            }
            sdUICharacter.Instance.ShowItemSelectWnd(SelectType.GemOn);
            sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(sdUICharacter.Instance.GetItemUpWnd().SelectGemSet));
            sdGameItemMgr.Instance.gemIndex = index;
            return;
        }
        else if (panel == PanelType.Panel_PvpReward || panel == PanelType.Panel_PVPRankReward)
        {
            if (itemid == "100" || itemid == "101" || itemid == "200" || itemid.Length == 0)
            {
                return;
            }
            Hashtable info = sdConfDataMgr.Instance().GetItemById(itemid);
            if (info != null && info.ContainsKey("Class") && int.Parse(info["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item)
            {
                sdUIPetControl.Instance.ActivePetSmallTip(null, int.Parse(itemInfo["Expend"].ToString()), 0, 1);
                return;
            }
            else
            {
                sdUICharacter.Instance.ShowTip(TipType.TempItem, tempId);
                return;
            }
        }

        if (itemid == "")
        {
            if (panel == PanelType.Panel_Equip)
            {
                if (sdGameItemMgr.Instance.GetBagItemByEquipPos(index, true).Count == 0)
                {
                    sdUICharacter.Instance.ShowMsgLine(sdConfDataMgr.Instance().GetShowStr("NoEquip"), Color.yellow);
                    return;
                }
                //sdUICharacter.Instance.ShowBag();
                sdUICharacter.Instance.SetSelectWndNeedPos(index);
                sdUICharacter.Instance.ShowItemSelectWnd(SelectType.EquipSelect);
                sdUICharacter.Instance.AddEventOnSelectWnd(new EventDelegate(sdUICharacter.Instance.OnChangeEquip));
                //sdSlotMgr.Instance.GotoEquip(index);
            }
            return;
        }

        if (!enable)
        {
            return;
        }

        if (panel == PanelType.Panel_Skill_Active || panel == PanelType.Panel_Skill_Passive)
        {
            Hashtable   item  = sdConfDataMgr.Instance().GetSkill(itemid);
            sdGameSkill skill = sdGameSkillMgr.Instance.GetSkill(int.Parse(itemid));
            TipType     type  = (panel == PanelType.Panel_Skill_Active)?TipType.Skill:TipType.PassiveSkill;
            sdUICharacter.Instance.ShowTip(type, itemid);
            return;
        }

        if (panel == PanelType.Panel_Treasure)
        {
            return;

            sdUICharacter.Instance.ShowTip(TipType.TempItem, itemid);
            return;
        }

        if (panel == PanelType.Panel_Jiesuan)
        {
            if (jiesuanType == JiesuanSlotType.Pet)
            {
                Hashtable info = sdConfDataMgr.Instance().GetItemById(itemid);
                if (info == null)
                {
                    info = itemInfo;
                }
                if (info != null)
                {
                    sdUIPetControl.Instance.ActivePetSmallTip(null, int.Parse(itemInfo["Expend"].ToString()), 0, 1);
                }

                return;
            }
            else if (jiesuanType == JiesuanSlotType.PetItem)
            {
                sdGamePetItem petItem = sdNewPetMgr.Instance.getPetItem(ulong.Parse(itemid));
                if (petItem != null)
                {
                    sdUIPetControl.Instance.ActivePetEquipTip(null, petItem.templateID);
                }

                return;
            }
        }

        if (panel == PanelType.Panel_ItemSelect)
        {
            if (!isSelected)
            {
                if (sdUICharacter.Instance.AddSelectItem(itemid))
                {
                    isSelected = true;
                    if (gameObject.transform.FindChild("bgselect") != null)
                    {
                        gameObject.transform.FindChild("bgselect").GetComponent <UISprite>().spriteName = "g";
                    }
                }
            }
            else
            {
                isSelected = false;
                if (gameObject.transform.FindChild("bgselect") != null)
                {
                    gameObject.transform.FindChild("bgselect").GetComponent <UISprite>().spriteName = "";
                }

                sdUICharacter.Instance.RemoveSelectItem(itemid);
            }
            return;
        }

        if (panel == PanelType.Panel_Bag)
        {
            sdGameItem item = sdGameItemMgr.Instance.getItem(ulong.Parse(itemid));
            if (item != null)
            {
                item.isNew = false;
            }
            SetNew(false);
            sdRoleWnd wnd = sdUICharacter.Instance.GetRoleWnd().GetComponent <sdRoleWnd>();
            if (wnd != null)
            {
                if (wnd.otherBtn.isActive)
                {
                    bool      hasNew    = false;
                    Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem((int)PanelType.Panel_Bag, (int)ItemFilter.Other);
                    foreach (DictionaryEntry info in itemTable)
                    {
                        sdGameItem temp = info.Value as sdGameItem;
                        if (temp.isNew)
                        {
                            hasNew = true;
                            break;
                        }
                    }

                    if (!hasNew)
                    {
                        wnd.otherBtn.HideRedTip();
                    }
                }

                if (wnd.armorBtn.isActive)
                {
                    bool      hasNew    = false;
                    Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem((int)PanelType.Panel_Bag, (int)ItemFilter.Armor);
                    foreach (DictionaryEntry info in itemTable)
                    {
                        sdGameItem temp = info.Value as sdGameItem;
                        if (temp.isNew)
                        {
                            hasNew = true;
                            break;
                        }
                    }

                    if (!hasNew)
                    {
                        wnd.armorBtn.HideRedTip();
                    }
                }

                if (wnd.weaponBtn.isActive)
                {
                    bool      hasNew    = false;
                    Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem((int)PanelType.Panel_Bag, (int)ItemFilter.Weapon);
                    foreach (DictionaryEntry info in itemTable)
                    {
                        sdGameItem temp = info.Value as sdGameItem;
                        if (temp.isNew)
                        {
                            hasNew = true;
                            break;
                        }
                    }

                    if (!hasNew)
                    {
                        wnd.weaponBtn.HideRedTip();
                    }
                }

                if (wnd.shipinBtn.isActive)
                {
                    bool      hasNew    = false;
                    Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem((int)PanelType.Panel_Bag, (int)ItemFilter.Shipin);
                    foreach (DictionaryEntry info in itemTable)
                    {
                        sdGameItem temp = info.Value as sdGameItem;
                        if (temp.isNew)
                        {
                            hasNew = true;
                            break;
                        }
                    }

                    if (!hasNew)
                    {
                        wnd.shipinBtn.HideRedTip();
                    }
                }
            }
        }

        sdUICharacter.Instance.ShowTip(TipType.Item, itemid);
    }