示例#1
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(1))
     {
         GameObject gameObject = UnityEngine.Object.Instantiate(CachedRes.getUnitAtResPath("Zhousi")) as GameObject;
     }
 }
示例#2
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));
    }
示例#3
0
    public static SkinPanel genSkinPanel(Transform parent)
    {
        GameObject gameObject = NGUITools.AddChild(parent.gameObject, CachedRes.getUITemplate("skinPanel"));
        SkinPanel  component  = gameObject.GetComponent <SkinPanel>();

        gameObject.layer = parent.gameObject.layer;
        return(component);
    }
示例#4
0
 public void DoClearToHome()
 {
     CachedRes.ClearResources();
     ResourceManager.ClearResources();
     UIAtlas[] loadedUIAtlas = this.GetLoadedUIAtlas();
     this.ClearUIAtlasTexture(this._newbieGuideAtlasNames, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._loginAtlasNames, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._pvploadingAtlasNames, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._battlingAtlasNames, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._battleSettlementAtlasNames, loadedUIAtlas);
     this.DoClearTextures();
     Resources.UnloadUnusedAssets();
 }
示例#5
0
    public static Texture2D GetShinedFigure(string fig)
    {
        string text = null;

        if (!string.IsNullOrEmpty(fig))
        {
            text = "Texture/MagicBottle/Shined_figures_" + fig;
        }
        if (!string.IsNullOrEmpty(text))
        {
            return((Texture2D)CachedRes.getTex(text));
        }
        return(null);
    }
示例#6
0
 public void DoClearToBattleLoading()
 {
     HomeAtlasPreloader.Unload();
     CachedRes.ClearResources();
     ResourceManager.ClearResources();
     UIAtlas[] loadedUIAtlas = this.GetLoadedUIAtlas();
     this.ClearUIAtlasTexture(this._homeAtlasNames, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._loadLevelLoading, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._loginAtlasNames, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._battlingAtlasNames, loadedUIAtlas);
     this.ClearUIAtlasTexture(this._battleSettlementAtlasNames, loadedUIAtlas);
     this.DoClearTextures();
     Resources.UnloadUnusedAssets();
 }
示例#7
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));
        }
示例#8
0
 public static GameObject getClonedUnit(string resPath)
 {
     return(UnityEngine.Object.Instantiate(CachedRes.getUnitAtResPath(resPath)) as GameObject);
 }
示例#9
0
    public static AudioClip getAudio(string fileName)
    {
        string path = "Audio/" + fileName;

        return(CachedRes.getFrom(path, ref CachedRes._audios, false) as AudioClip);
    }
示例#10
0
 public static Texture getTex(string path)
 {
     return(CachedRes.getFrom(path, ref CachedRes._textures, false) as Texture);
 }
示例#11
0
 public static UnityEngine.Object loadRes(string path)
 {
     return(CachedRes.getFrom(path, ref CachedRes._res, false));
 }
示例#12
0
 public static GameObject getSpellPrefab(string resPath, bool ignoreError = false)
 {
     return(CachedRes.getFrom(resPath, ref CachedRes._spellsPrefabs, ignoreError) as GameObject);
 }
示例#13
0
 public SkinInfo(int skinid, List <float> info, bool is_wear = false)
 {
     this.iswear  = is_wear;
     this._skinId = skinid;
     this._tex    = CachedRes.getSkinTex(this.skinId);
     if (info != null)
     {
         if (info[0] == 1f)
         {
             this.containerType = 3;
             this.discount      = info[1];
             this.costType      = Convert.ToInt32(info[2]);
             int num = this.costType;
             if (num != 1)
             {
                 if (num != 2)
                 {
                     if (num == 9)
                     {
                         this.cost_bottle = info[3];
                     }
                 }
                 else
                 {
                     this._cost = info[3];
                 }
             }
             else
             {
                 this.cost_money = info[3];
             }
         }
         else
         {
             this.containerType = Convert.ToInt32(info[info.Count - 1]);
             this.discount      = 0f;
             int num = this.containerType;
             if (num != 1)
             {
                 if (num == 2)
                 {
                     this.costType         = Convert.ToInt32(info[1]);
                     this.costType_another = Convert.ToInt32(info[2]);
                 }
             }
             else
             {
                 this.costType = Convert.ToInt32(info[1]);
             }
             if (this.costType_another == 0)
             {
                 num = this.costType;
                 if (num != 1)
                 {
                     if (num != 2)
                     {
                         if (num == 9)
                         {
                             this.cost_bottle = info[2];
                         }
                     }
                     else
                     {
                         this._cost = info[2];
                     }
                 }
                 else
                 {
                     this.cost_money = info[2];
                 }
             }
             else
             {
                 num = this.costType;
                 if (num != 1)
                 {
                     if (num != 2)
                     {
                         if (num == 9)
                         {
                             this.cost_bottle = info[3];
                         }
                     }
                     else
                     {
                         this._cost = info[3];
                     }
                 }
                 else
                 {
                     this.cost_money = info[3];
                 }
                 num = this.costType_another;
                 if (num != 1)
                 {
                     if (num != 2)
                     {
                         if (num == 9)
                         {
                             this.cost_bottle = info[4];
                         }
                     }
                     else
                     {
                         this._cost = info[4];
                     }
                 }
                 else
                 {
                     this.cost_money = info[4];
                 }
             }
         }
         return;
     }
 }
示例#14
0
 public SkinInfo(int skinId, int cost)
 {
     this._skinId = skinId;
     this._tex    = CachedRes.getSkinTex(skinId);
     this._cost   = (float)cost;
 }
示例#15
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();
    }