Example #1
0
    public static Texture getSkinTex(int skinId)
    {
        SysHeroSkinVo sysHeroSkinVo = BaseDataMgr.instance.GetDicByType <SysHeroSkinVo>()[skinId.ToString()] as SysHeroSkinVo;
        SysGameResVo  sysGameResVo  = BaseDataMgr.instance.GetDicByType <SysGameResVo>()[sysHeroSkinVo.Loading_icon] as SysGameResVo;
        string        path          = sysGameResVo.path;

        return(CachedRes.getTex(path));
    }
Example #2
0
        public static string GetHeroSkinPath(string pathWithoutSkin, int skinId)
        {
            string result;

            if (skinId == 0)
            {
                result = pathWithoutSkin;
            }
            else
            {
                SysHeroSkinVo sysHeroSkinVo = BaseDataMgr.instance.GetDicByType <SysHeroSkinVo>()[skinId.ToString()] as SysHeroSkinVo;
                SysGameResVo  sysGameResVo  = BaseDataMgr.instance.GetDicByType <SysGameResVo>()[sysHeroSkinVo.model_id] as SysGameResVo;
                result = sysGameResVo.id;
            }
            return(result);
        }
Example #3
0
        public static GameObject GetHeroPrefabWithSkin(string pathWithoutSkin, int skinId)
        {
            string resPath = string.Empty;

            if (skinId == 0)
            {
                resPath = pathWithoutSkin;
            }
            else
            {
                SysHeroSkinVo sysHeroSkinVo = BaseDataMgr.instance.GetDicByType <SysHeroSkinVo>()[skinId.ToString()] as SysHeroSkinVo;
                SysGameResVo  sysGameResVo  = BaseDataMgr.instance.GetDicByType <SysGameResVo>()[sysHeroSkinVo.model_id] as SysGameResVo;
                resPath = sysGameResVo.path;
            }
            GameObject unitAtResPath = CachedRes.getUnitAtResPath(resPath);

            if (unitAtResPath != null)
            {
                return(unitAtResPath);
            }
            return(CachedRes.getUnitAtResPath(pathWithoutSkin));
        }
Example #4
0
 public static void GetHeroSkinResPath(int skin, SysGameResVo gameRes, ref string path, ref string gameResId, bool isMonster = false)
 {
     if (gameRes != null)
     {
         path      = gameRes.path;
         gameResId = gameRes.id;
         if (gameRes.type == 7 && gameRes.group == "common")
         {
             return;
         }
     }
     if (skin > 0)
     {
         if (skin <= 9)
         {
             if (isMonster)
             {
                 path      = path + "0" + skin;
                 gameResId = gameResId + "0" + skin;
             }
             else
             {
                 path      = path + "_skin0" + skin;
                 gameResId = gameResId + "_skin0" + skin;
             }
         }
         else if (isMonster)
         {
             path      += skin;
             gameResId += skin;
         }
         else
         {
             path      = path + "_skin" + skin;
             gameResId = gameResId + "_skin" + skin;
         }
     }
 }
    public static T Load <T>(string resId, bool loadFromCache = true, bool loadFromBundle = true, Action <T> firstLoadCallback = null, int skin = 0, bool isMonsterSkin = false) where T : class
    {
        if (resId == null || resId == "[]")
        {
            return((T)((object)null));
        }
        SysGameResVo gameResData = BaseDataMgr.instance.GetGameResData(resId);

        if (gameResData == null)
        {
            Debug.LogError("no such resId:" + resId + " 请检查GameRes表");
            return((T)((object)null));
        }
        if (ResourceManager.openLog)
        {
        }
        string path = gameResData.path;
        string id   = gameResData.id;

        HeroSkins.GetHeroSkinResPath(skin, gameResData, ref path, ref id, isMonsterSkin);
        if (loadFromBundle && !string.IsNullOrEmpty(gameResData.bundle) && gameResData.bundle != "[]")
        {
            string bundle = gameResData.bundle;
            if (ResourceManager.openLog)
            {
            }
            if (ResourceManager.openLog)
            {
            }
            if (loadFromCache)
            {
                T t = AssetLoader.Load(path, bundle, false) as T;
                if (t != null)
                {
                    return(t);
                }
            }
            else
            {
                T t2 = UnityEngine.Object.Instantiate(AssetLoader.Load(gameResData.path, bundle, false)) as T;
                AssetLoader.Instance.UnloadCachedAsset(path, bundle);
                if (t2 != null)
                {
                    return(t2);
                }
            }
        }
        if (ResourceManager.openLog)
        {
        }
        if (ResourceManager.openLog)
        {
        }
        UnityEngine.Object @object = null;
        bool flag = ResourceManager.m_gameResList.TryGetValue(id, out @object);

        if (!flag || @object == null)
        {
            string[] array = path.Split(new char[]
            {
                '/'
            });
            if (array != null && array[array.Length - 1] != null)
            {
                @object = AssetBundleMgr.Instance.Load(array[array.Length - 1], gameResData.bundle);
            }
            if (@object == null)
            {
                @object = Resources.Load(path);
            }
            if (@object != null)
            {
                if (flag)
                {
                    ResourceManager.m_gameResList[id] = @object;
                }
                else
                {
                    ResourceManager.m_gameResList.Add(id, @object);
                }
            }
            else if (skin == 0)
            {
                Debug.LogError("缺少美术资源 " + resId + " 在gameres表中的path:" + path);
            }
        }
        if (!loadFromCache)
        {
            return(UnityEngine.Object.Instantiate(@object) as T);
        }
        if (gameResData == null)
        {
            Debug.LogError("error gameRes id=" + resId);
            return((T)((object)null));
        }
        T t3 = @object as T;

        if (t3 != null && firstLoadCallback != null)
        {
            firstLoadCallback(t3);
        }
        return(t3);
    }
    public static GameObject GetSkinnedHeroPrefab(TeamType team, string heroResId)
    {
        SysGameResVo gameResData = BaseDataMgr.instance.GetGameResData(heroResId);

        return(HeroSkins.GetHeroPrefabWithSkin(gameResData.path, HeroSkins.GetHeroSkin(team, heroResId)));
    }
Example #7
0
    private void InitialSignItems(int checkCount, int week)
    {
        for (int i = 1; i <= this.RewardList.childCount; i++)
        {
            int num = i + week * 7;
            this.RewardList.GetChild(i - 1).name = num.ToString();
            UIEventListener.Get(this.RewardList.Find(num.ToString()).gameObject).onPress = new UIEventListener.BoolDelegate(this.ShowRewardInfo);
            this.RewardList.Find(num + "/Rune").gameObject.SetActive(false);
            this.RewardList.Find(num + "/Reward/Sprite").GetComponent <UISprite>().spriteName = "img_color";
            this.RewardList.Find(num + "/Reward/Sprite").GetComponent <UISprite>().color      = new Color32(254, 185, 0, 255);
            SysAttendanceRewardsVo dataById     = BaseDataMgr.instance.GetDataById <SysAttendanceRewardsVo>(num.ToString());
            SysGameResVo           sysGameResVo = new SysGameResVo();
            if (dataById == null)
            {
                ClientLogger.Error(" Can't find id:" + num.ToString() + "in SysAttendanceRewardsVo");
            }
            else
            {
                if ("[]" != dataById.icon)
                {
                    if (BaseDataMgr.instance.GetGameResData(dataById.icon) == null)
                    {
                        ClientLogger.Error(" Can't find id:" + dataById.icon + "in SysGameResVo");
                    }
                    else
                    {
                        this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().mainTexture = ResourceManager.Load <Texture>(dataById.icon, true, true, null, 0, false);
                    }
                }
                SysDropRewardsVo dataById2 = BaseDataMgr.instance.GetDataById <SysDropRewardsVo>(dataById.rewards.ToString());
                SysDropItemsVo   dataById3 = BaseDataMgr.instance.GetDataById <SysDropItemsVo>(dataById2.drop_items);
                if (dataById3 == null)
                {
                    ClientLogger.Error(" Can't find id:" + dataById2.drop_items + "in SysDropItemsVo");
                }
                else
                {
                    string[] array = dataById3.rewards.Split(new char[]
                    {
                        '|'
                    });
                    string text = array[0];
                    switch (text)
                    {
                    case "1":
                    {
                        this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().width  = 206;
                        this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().height = 206;
                        this.RewardList.Find(num + "/Reward/Sprite").gameObject.SetActive(false);
                        SysCurrencyVo dataById4 = BaseDataMgr.instance.GetDataById <SysCurrencyVo>(array[1]);
                        if (dataById4 != null)
                        {
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById(dataById4.name);
                        }
                        this.RewardList.Find(num + "/RewardCount").GetComponent <UILabel>().text = "x" + array[2];
                        break;
                    }

                    case "2":
                    {
                        SysGameItemsVo dataById5 = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(array[1]);
                        this.RewardList.Find(num + "/Reward/Sprite").gameObject.SetActive(true);
                        if (dataById5.type != 4 && dataById5.type != 10)
                        {
                            if (array[1] == "7777" || array[1] == "8000")
                            {
                                this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().width  = 206;
                                this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().height = 206;
                                this.RewardList.Find(num + "/Reward/Sprite").gameObject.SetActive(false);
                                this.RewardList.Find(num + "/RewardCount").GetComponent <UILabel>().text = "x" + array[2];
                            }
                            else
                            {
                                this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().width  = 140;
                                this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().height = 140;
                            }
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById(dataById5.name);
                        }
                        else if (dataById5.type == 10)
                        {
                            this.RewardList.Find(num + "/Reward/Sprite").gameObject.SetActive(true);
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById(dataById5.role);
                            this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().width  = 140;
                            this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().height = 140;
                        }
                        else
                        {
                            this.RewardList.Find(num + "/Rune").gameObject.SetActive(true);
                            this.RewardList.Find(num + "/Rune").GetComponent <UISprite>().spriteName          = dataById5.icon;
                            this.RewardList.Find(num + "/Reward/Sprite").GetComponent <UISprite>().spriteName = "Checkins_icons_frame_0" + dataById5.quality;
                            this.RewardList.Find(num + "/Reward/Sprite").GetComponent <UISprite>().color      = Color.white;
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text           = LanguageManager.Instance.GetStringById("Currency_Rune");
                            this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().width            = 150;
                            this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().height           = 172;
                        }
                        this.RewardList.Find(num + "/RewardCount").GetComponent <UILabel>().text = "x" + array[2];
                        break;
                    }

                    case "3":
                    {
                        this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().width  = 140;
                        this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().height = 140;
                        this.RewardList.Find(num + "/Reward/Sprite").gameObject.SetActive(true);
                        this.RewardList.Find(num + "/Reward/Sprite").GetComponent <UISprite>().spriteName = "Checkins_icons_frame_04";
                        this.RewardList.Find(num + "/Reward/Sprite").GetComponent <UISprite>().color      = Color.white;
                        string text2 = array[1];
                        switch (text2)
                        {
                        case "1":
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById("Currency_Hero");
                            break;

                        case "2":
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById("Currency_Skin");
                            break;

                        case "3":
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById("Currency_HeadPortrait");
                            break;

                        case "4":
                            this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById("Currency_PictureFrame");
                            break;
                        }
IL_9C5:
                        this.RewardList.Find(num + "/RewardCount").GetComponent <UILabel>().text = "x1";
                        break;
                        goto IL_9C5;
                    }

                    case "4":
                        this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().width  = 123;
                        this.RewardList.Find(num + "/Reward").GetComponent <UITexture>().height = 123;
                        this.RewardList.Find(num + "/Reward/Sprite").gameObject.SetActive(false);
                        this.RewardList.Find(num + "/RewardName").GetComponent <UILabel>().text  = ((!(array[1] == "1")) ? "小魔瓶经验" : "召唤师经验");
                        this.RewardList.Find(num + "/RewardCount").GetComponent <UILabel>().text = "x" + array[2];
                        break;
                    }
                }
            }
        }
    }
Example #8
0
    public void setHeroName(string heroId, long heroid, int skinId = 0, bool isSame = false)
    {
        if (Singleton <PvpSelectHeroView> .Instance.gameObject != null && Singleton <PvpSelectHeroView> .Instance.gameObject.activeInHierarchy)
        {
            Singleton <PropertyView> .Instance.HeroNpc = heroId;
        }
        this.list_goodsdata.Clear();
        this.list_goodsdata.AddRange(ModelManager.Instance.Get_ShopGoodsList());
        if (this.list_goodsdata == null)
        {
            return;
        }
        string           price = null;
        List <GoodsData> list  = new List <GoodsData>();

        list = this.list_goodsdata.FindAll((GoodsData obj) => obj.Type == 2);
        List <GoodsData> list2 = new List <GoodsData>();

        if (list == null)
        {
            return;
        }
        list2 = list.FindAll((GoodsData obj) => obj.ElementId == skinId.ToString());
        if (list2 == null)
        {
            return;
        }
        if (list2.Count == 0)
        {
            price = null;
        }
        else
        {
            price = this.StringPrice(list2);
        }
        this.SetWearBtnState(heroid, skinId);
        this.SetBuyBtnState(skinId);
        this._heroName = heroId;
        if (this._skins == null)
        {
            this._skins = new List <Skin>();
        }
        else
        {
            foreach (Skin current in this._skins)
            {
                UnityEngine.Object.Destroy(current.gameObject);
            }
            if (this._copy != null)
            {
                UnityEngine.Object.Destroy(this._copy.gameObject);
            }
            this._skins.Clear();
        }
        List <SkinInfo> list3         = new List <SkinInfo>();
        List <SkinInfo> list4         = new List <SkinInfo>();
        SysHeroMainVo   sysHeroMainVo = BaseDataMgr.instance.GetDicByType <SysHeroMainVo>()[heroId] as SysHeroMainVo;
        SysGameResVo    sysGameResVo  = BaseDataMgr.instance.GetDicByType <SysGameResVo>()[sysHeroMainVo.Loading_icon] as SysGameResVo;
        Texture         tex           = CachedRes.getTex(sysGameResVo.path);

        list4.Add(new SkinInfo(tex, this.GetSkinPrice(0)));
        if (sysHeroMainVo.skin_id != "[]")
        {
            int[] stringToInt = StringUtils.GetStringToInt(sysHeroMainVo.skin_id, ',');
            if (skinId == 0)
            {
                list3.Add(new SkinInfo(tex, this.GetSkinPrice(0)));
                int[] array = stringToInt;
                int   id;
                for (int i = 0; i < array.Length; i++)
                {
                    id = array[i];
                    if (list != null)
                    {
                        list2 = list.FindAll((GoodsData obj) => obj.ElementId == id.ToString());
                        if (list2 == null || list2.Count == 0)
                        {
                            price = null;
                        }
                        else
                        {
                            price = this.StringPrice(list2);
                        }
                    }
                    list3.Add(new SkinInfo(id, this.ParsePrice(price), SkinPanel.IsPossessSkinId(id) || SkinPanel.IsWearSkin(heroid, id)));
                }
            }
            else
            {
                list3.Add(new SkinInfo(skinId, this.ParsePrice(price), SkinPanel.IsPossessSkinId(skinId) || SkinPanel.IsWearSkin(heroid, skinId)));
                int[] array2 = stringToInt;
                int   it2;
                for (int j = 0; j < array2.Length; j++)
                {
                    it2 = array2[j];
                    if (list != null)
                    {
                        list2 = list.FindAll((GoodsData obj) => obj.ElementId == it2.ToString());
                        if (list2 == null || list2.Count == 0)
                        {
                            price = null;
                        }
                        else
                        {
                            price = this.StringPrice(list2);
                        }
                    }
                    if (it2 > skinId)
                    {
                        list3.Add(new SkinInfo(it2, this.ParsePrice(price), SkinPanel.IsPossessSkinId(it2) || SkinPanel.IsWearSkin(heroid, it2)));
                    }
                }
                if (!list3.Contains(list3.Find((SkinInfo obj) => obj.skinId == 0)))
                {
                    list3.Add(new SkinInfo(tex, this.GetSkinPrice(0)));
                }
                int[] array3 = stringToInt;
                int   it;
                for (int k = 0; k < array3.Length; k++)
                {
                    it = array3[k];
                    if (list != null)
                    {
                        list2 = list.FindAll((GoodsData obj) => obj.ElementId == it.ToString());
                        if (list2 == null || list2.Count == 0)
                        {
                            price = null;
                        }
                        else
                        {
                            price = this.StringPrice(list2);
                        }
                    }
                    if (it < skinId)
                    {
                        list3.Add(new SkinInfo(it, this.ParsePrice(price), SkinPanel.IsPossessSkinId(it) || SkinPanel.IsWearSkin(heroid, it)));
                    }
                }
            }
        }
        if (!list3.Contains(list3.Find((SkinInfo obj) => obj.skinId == 0)))
        {
            list3.Add(new SkinInfo(tex, this.GetSkinPrice(0)));
        }
        this._copy = NGUITools.AddChild(base.gameObject, Skin.prefab).GetComponent <Skin>();
        List <Skin> list5 = new List <Skin>();

        for (int l = 0; l < list3.Count; l++)
        {
            if (!(ToolsFacade.ServerCurrentTime < new DateTime(2016, 12, 19, 0, 0, 0)) || list3[l].skinId != 102802)
            {
                Skin     component = NGUITools.AddChild(base.gameObject, Skin.prefab).GetComponent <Skin>();
                SkinInfo skinInfo  = list3[l];
                component.name = "texture:" + l;
                component.setSkinInfo(skinInfo, this.IsPossess(skinInfo.skinId), this.IsWear(heroid, skinInfo.skinId));
                component.toAlpha = 1f;
                list5.Add(component);
            }
        }
        if (!isSame)
        {
            base.gameObject.transform.localPosition = Vector3.zero;
            if (list5.Count >= 2)
            {
                if (list5.Count >= 3)
                {
                    base.gameObject.transform.localPosition = base.gameObject.transform.localPosition + new Vector3(-81f, -81f, 0f);
                }
                else
                {
                    base.gameObject.transform.localPosition = base.gameObject.transform.localPosition + new Vector3(-45f, -81f, 0f);
                }
            }
            else
            {
                base.gameObject.transform.localPosition = base.gameObject.transform.localPosition + new Vector3(0f, -81f, 0f);
            }
        }
        for (int m = 0; m < list5.Count; m++)
        {
            this._skins.Add(list5[m]);
        }
        this._oldPoses = this._poses;
        Vector3 vector = new Vector3(-300f, 0f, 0f);
        Vector3 a      = new Vector3(0f, 0f, 0f);
        Vector3 a2     = new Vector3(142f, 12f, 0f);
        float   num    = 0.8f;

        this._skins[0].toPos = vector;
        this._poses          = new List <Vector3>();
        this._alphas         = new List <float>();
        this._poses.Add(vector);
        for (int n = 0; n <= this._skins.Count; n++)
        {
            Vector3 b = a2 * (float)n;
            this._poses.Add(a + b);
        }
        this._scales = new List <float>();
        this._scales.Add(1f);
        for (int num2 = 0; num2 <= this._skins.Count; num2++)
        {
            if (num2 == 0)
            {
                this._scales.Add(1f);
            }
            else
            {
                float item = (num2 < 2) ? num : (Mathf.Pow(num, (float)num2) - 0.064f);
                this._scales.Add(item);
            }
        }
        this._alphas.Add(0f);
        for (int num3 = 0; num3 < this._skins.Count; num3++)
        {
            if (num3 > 2)
            {
                this._alphas.Add(0f);
            }
            else
            {
                this._alphas.Add(1f / (float)(num3 + 1));
            }
        }
        this._alphas.Add(0f);
        if (isSame && this._oldPoses != null)
        {
            this._poses = this._oldPoses;
        }
        foreach (Skin current2 in this._skins)
        {
            int index = this._skins.IndexOf(current2) + 1;
            current2.trans.localPosition = this._poses[index];
            current2.trans.localScale    = new Vector3(this._scales[index], this._scales[index], 1f);
            current2.SetAlpha(this._alphas[index]);
        }
        this.resetDepth();
    }