Example #1
0
    /// <summary>
    /// 获取配置的所有时装
    /// </summary>
    public void GetAllFashion()
    {
        fashionDic.Clear();
        weaponFashionDic.Clear();
        clothesFashionDic.Clear();
        List <FashionRef> list = ConfigMng.Instance.FashionList();

        for (int i = 0; i < list.Count; i++)
        {
            if (list[i] == null)
            {
                continue;
            }
            FashionInfo info = new FashionInfo(list[i].id);
            fashionDic[info.FashionID] = info;
            if (list[i].type == 1 && list[i].prof == GameCenter.mainPlayerMng.MainPlayerInfo.Prof)
            {
                if (info.Time == 0)
                {
                    weaponFashionDic[info.FashionID] = info;
                }
            }
            if (list[i].type == 2 && list[i].prof == GameCenter.mainPlayerMng.MainPlayerInfo.Prof)
            {
                if (info.Time == 0)
                {
                    clothesFashionDic[info.FashionID] = info;
                }
            }
        }
        SetCurFashionInfo();
    }
Example #2
0
    public void SetCurFashionInfo()
    {
        //Debug.Log("修改TYPE:" + CurFashionWndType);
        switch (CurFashionWndType)
        {
        case FashionWndType.CLOTHES: if (clothesFashionList.Count > 0)
            {
                CurTargetFashion = clothesFashionList[0];
            }
            break;

        case FashionWndType.WEAPON: if (weaponFashionList.Count > 0)
            {
                CurTargetFashion = weaponFashionList[0];
            }
            break;

        default: if (clothesFashionList.Count > 0)
            {
                CurTargetFashion = clothesFashionList[0];
            }
            break;
        }
        //Debug.Log("修改TYPE:" + CurFashionWndType + ":" + CurTargetFashion.FashionID + ":" + firstClothesInfo.FashionID + ":" + firstWeaponInfo.FashionID);
    }
Example #3
0
    void BuySkin()
    {
        if (!TSCData.Instance.ContainSkin(Id))
        {
            SetLock(true);
            EquipInfo info = InfoMgr <EquipInfo> .Instance.GetInfo(Id);

            if (info.equipType + 1 == (int)ShopItemType.ShopItem_TAO)
            {
                FashionInfo fashionInfo = InfoMgr <FashionInfo> .Instance.GetInfo(Id);

                if (null != fashionInfo)
                {
                    TSCData.Instance.AddSkin(fashionInfo.tigerId);
                    TSCData.Instance.AddSkin(fashionInfo.stickId);
                    TSCData.Instance.AddSkin(fashionInfo.chickId);
                }
            }

            TSCData.Instance.AddSkin(Id);
            UIShopInfo shop = UIManager.Instance.GetGameWindowScript <UIShopInfo>(WindowID.WindowID_Shopping);
            if (null != shop)
            {
                shop.BuySkinLock();
            }
            TSCData.Instance.SaveHeroSkin();
        }
    }
Example #4
0
    /// <summary>
    /// 填充数据
    /// </summary>
    /// <param name="_info"></param>
    public void FillInfo(FashionInfo _info)
    {
        if (_info == null) {
            fashionInfo = null;
        }
        else {
            fashionInfo = _info;
            eq = new EquipmentInfo (fashionInfo.Item, EquipmentBelongTo.PREVIEW);
        }

        RefreshFashion ();
    }
Example #5
0
 /// <summary>
 /// 重置数据
 /// </summary>
 void ResetData()
 {
     ownFashionList.Clear();
     tempFashionList.Clear();
     clothesFashionDic.Clear();
     weaponFashionDic.Clear();
     fashionDic.Clear();
     cacheFashionDic.Clear();
     AllAttrNum.Clear();
     CurFashionWndType   = FashionWndType.CLOTHES;
     inUseClothesFashion = null;
     inUseWeaponFashion  = null;
     CurTargetFashion    = null;
     isFirstTime         = true;
     fashionLev          = 0;
     fashionExp          = 0;
 }
Example #6
0
    /// <summary>
    /// 获得穿上的时装
    /// </summary>
    /// <param name="_pt"></param>
    protected void S2C_PutFashion(Pt _pt)
    {
        pt_updata_model_clothes_d414 pt = _pt as pt_updata_model_clothes_d414;

        if (pt != null)
        {
            RemainTime time = null;
            if (pt.time > 0)
            {
                time = new RemainTime(pt.time, Time.time);
            }
            FashionInfo F = new FashionInfo(pt.model_id);
            if (pt.put_state == 1)
            {
                FashionInfo fashion = new FashionInfo(pt.model_id, 1, pt.put_state, time);
                if (fashion.FashionType == 1)
                {
                    InUseWeaponFashion = fashion;
                }
                if (fashion.FashionType == 2)
                {
                    InUseClothesFashion = fashion;
                }
            }
            if (pt.put_state == 0)
            {
                if (F.FashionType == 1)
                {
                    InUseWeaponFashion = null;
                }
                if (F.FashionType == 2)
                {
                    InUseClothesFashion = null;
                }
            }
            GameCenter.mainPlayerMng.MainPlayerInfo.UpdateEquipment(F.Item, (pt.put_state == 1)); //eid为时装的物品表ID
        }
        //if (OnUpdateFashion != null) {
        //    OnUpdateFashion ();
        //}
        if (OnChangeTargetFashion != null)
        {
            OnChangeTargetFashion();
        }
    }
Example #7
0
    void RefreshTemporaryFashion()
    {
        List <int> targetList = new List <int>();

        using (var e = fashionDic.GetEnumerator())
        {
            while (e.MoveNext())
            {
                if (e.Current.Value.FashionRef.time != 0)
                {
                    targetList.Add(e.Current.Value.FashionID);
                }
            }
        }
        for (int i = 0; i < targetList.Count; i++)
        {
            if (fashionDic.ContainsKey(targetList[i]))
            {
                fashionDic[targetList[i]] = new FashionInfo(targetList[i]);
            }
        }
    }
Example #8
0
    /// <summary>
    /// 获取所有的时装
    /// </summary>
    /// <param name="_pt"></param>
    protected void S2C_GetFashionList(Pt _pt)
    {
        pt_model_clothes_list_d412 pt = _pt as pt_model_clothes_list_d412;

        //Debug.Log("收到时装协议");
        if (pt != null)
        {
            fashionLev = pt.model_lev;
            fashionExp = pt.model_exp;

            if (fashionDic.Count < 1)
            {
                GetAllFashion();
            }
            RefreshTemporaryFashion();
            if (fashionDic != null)
            {
                //GetAllTitle ();
                ownFashionList.Clear();
                tempFashionList.Clear();
                AllAttrNum.Clear();
                InUseClothesFashion = null;
                InUseWeaponFashion  = null;
            }
            for (int i = 0; i < pt.model_list.Count; i++)
            {
                RemainTime time = null;
                if (pt.model_list[i].remain_time > 0)
                {
                    time = new RemainTime(pt.model_list[i].remain_time, Time.time);
                }
                FashionInfo fashion = new FashionInfo(pt.model_list[i].model_id, pt.model_list[i].own_state, pt.model_list[i].put_state, time);
                if (!isFirstTime)
                {
                    if (!cacheFashionDic.ContainsKey(fashion.FashionID))
                    {
                        if (fashion.FashionType == 1)
                        {
                            CurFashionWndType = FashionWndType.WEAPON;
                        }
                        if (fashion.FashionType == 2)
                        {
                            CurFashionWndType = FashionWndType.CLOTHES;
                        }
                        GameCenter.uIMng.SwitchToSubUI(SubGUIType.SUBFASHION);
                    }
                }
                fashionDic[fashion.FashionID] = fashion;
                if (pt.model_list[i].put_state == 1)
                {
                    if (fashion.FashionType == 1)
                    {
                        InUseWeaponFashion = fashion;
                    }
                    if (fashion.FashionType == 2)
                    {
                        InUseClothesFashion = fashion;
                    }
                }
                if (pt.model_list[i].own_state == 1)
                {
                    ownFashionList.Add(fashion);
                }
                if (fashion.FashionType == 1)
                {
                    weaponFashionDic[fashion.FashionID] = fashion;
                    if (fashion.RemainTime != null)
                    {
                        if (fashion.TempID != 0)
                        {
                            if (weaponFashionDic.ContainsKey(fashion.TempID))
                            {
                                weaponFashionDic.Remove(fashion.TempID);
                            }
                        }
                    }
                    else
                    {
                        if (fashion.ForeverTempID != 0)
                        {
                            if (weaponFashionDic.ContainsKey(fashion.ForeverTempID))
                            {
                                weaponFashionDic.Remove(fashion.ForeverTempID);
                            }
                        }
                    }
                }
                if (fashion.FashionType == 2)
                {
                    clothesFashionDic[fashion.FashionID] = fashion;
                    if (fashion.RemainTime != null)
                    {
                        if (fashion.TempID != 0)
                        {
                            if (clothesFashionDic.ContainsKey(fashion.TempID))
                            {
                                clothesFashionDic.Remove(fashion.TempID);
                            }
                        }
                    }
                    else
                    {
                        if (fashion.ForeverTempID != 0)
                        {
                            if (clothesFashionDic.ContainsKey(fashion.ForeverTempID))
                            {
                                clothesFashionDic.Remove(fashion.ForeverTempID);
                            }
                        }
                    }
                }
                if (pt.model_list[i].remain_time > 0)
                {
                    tempFashionList.Add(fashion);
                    // Debug.Log ("时装列表发来的时间为"+pt.model_list [i].remain_time);
                }
                // Debug.Log("时装列表的长度为" + pt.model_list.Count + "时装ID为" + pt.model_list[i].model_id);

                cacheFashionDic[fashion.FashionID] = fashion;
            }

            if (ownFashionList.Count > 0)
            {
                for (int i = 0; i < ownFashionList.Count; i++)
                {
                    for (int j = 0; j < ownFashionList[i].Attribute.Count; j++)
                    {
                        ActorPropertyTag act = (ActorPropertyTag)ownFashionList[i].Attribute[j].eid;
                        AllAttrNum.Add(new AttributePair(act, ownFashionList[i].Attribute[j].count));
                    }
                }
            }
            if (tempFashionList.Count > 0)
            {
                for (int i = 0; i < tempFashionList.Count; i++)
                {
                    for (int j = 0; j < tempFashionList[i].Attribute.Count; j++)
                    {
                        ActorPropertyTag act = (ActorPropertyTag)tempFashionList[i].Attribute[j].eid;
                        AllAttrNum.Add(new AttributePair(act, tempFashionList[i].Attribute[j].count));
                    }
                }
            }
        }

        if (isFirstTime)
        {
            isFirstTime = false;
        }
        SortFashion();
        if (OnUpdateFashionList != null)
        {
            OnUpdateFashionList();
        }
        //Debug.Log("此时的衣服时装ID" + GameCenter.mainPlayerMng.MainPlayerInfo.GetServerData().clothesFashionID + "武器ID" + GameCenter.mainPlayerMng.MainPlayerInfo.GetServerData().weaponFashionID);
    }
Example #9
0
    void OpenItemDetail()
    {
        if (TSCData.Instance.ContainSkin(Id))
        {
            EquipInfo info = InfoMgr <EquipInfo> .Instance.GetInfo(Id);

            if (null != info)
            {
                bool change = false;
                //int lastId = -1;
                //int lastFashionId = Util.GetFashionClothId(TSCData.Instance.Role.KeyTigerID, TSCData.Instance.Role.KeyStickID, TSCData.Instance.Role.KeyChickID);
                if (info.equipType + 1 == (int)ShopItemType.ShopItem_TIGER)
                {
                    if (TSCData.Instance.Role.KeyTigerID != Id)
                    {
                        //lastId = TSCData.Instance.Role.KeyTigerID;
                        TSCData.Instance.Role.KeyTigerID = Id;
                        change = true;
                    }
                }
                else if (info.equipType + 1 == (int)ShopItemType.ShopItem_STICK)
                {
                    if (TSCData.Instance.Role.KeyStickID != Id)
                    {
                        //lastId = TSCData.Instance.Role.KeyStickID;
                        TSCData.Instance.Role.KeyStickID = Id;
                        change = true;
                    }
                }
                else if (info.equipType + 1 == (int)ShopItemType.ShopItem_CHICK)
                {
                    if (TSCData.Instance.Role.KeyChickID != Id)
                    {
                        //lastId = TSCData.Instance.Role.KeyChickID;
                        TSCData.Instance.Role.KeyChickID = Id;
                        change = true;
                    }
                }
                else if (info.equipType + 1 == (int)ShopItemType.ShopItem_TAO)
                {
                    FashionInfo fasion = InfoMgr <FashionInfo> .Instance.GetInfo(info.id);

                    if (null != fasion)
                    {
                        if (TSCData.Instance.Role.KeyTigerID != fasion.tigerId)
                        {
                            TSCData.Instance.Role.KeyTigerID = fasion.tigerId;
                            if (!change)
                            {
                                change = true;
                            }
                        }

                        if (TSCData.Instance.Role.KeyStickID != fasion.stickId)
                        {
                            TSCData.Instance.Role.KeyStickID = fasion.stickId;
                            if (!change)
                            {
                                change = true;
                            }
                        }

                        if (TSCData.Instance.Role.KeyChickID != fasion.chickId)
                        {
                            TSCData.Instance.Role.KeyChickID = fasion.chickId;
                            if (!change)
                            {
                                change = true;
                            }
                        }
                    }
                }

                if (change)
                {
                    UIBagInfo bagInfo   = UIManager.Instance.GetGameWindowScript <UIBagInfo>(WindowID.WindowID_Bag);
                    int       fashionId = Util.GetFashionClothId(TSCData.Instance.Role.KeyTigerID, TSCData.Instance.Role.KeyStickID, TSCData.Instance.Role.KeyChickID);
                    bagInfo.Refresh(TSCData.Instance.Role.KeyTigerID, TSCData.Instance.Role.KeyStickID, TSCData.Instance.Role.KeyChickID, fashionId);
                }
            }
        }
        else
        {
            EquipInfo info = InfoMgr <EquipInfo> .Instance.GetInfo(Id);

            UIManager.Instance.ShowWindow(WindowID.WindowID_Confirm);
            UIConfirm confirm = UIManager.Instance.GetGameWindowScript <UIConfirm>(WindowID.WindowID_Confirm);
            string    context = LanguageMgr.Instance.GetText(19, info.price.ToString(), LanguageMgr.Instance.GetText(info.nameId));
            confirm.SetTextContent(string.Empty, context);
            confirm.BindAction(BuySkin, null);
        }
    }