Пример #1
0
 // Token: 0x06000160 RID: 352 RVA: 0x00016254 File Offset: 0x00014454
 public static AssetBundle GetAssetBundle(CString Name, out int Key)
 {
     Key = Name.GetHashCode(true);
     AssetManager.AssRef value;
     if (!AssetManager.AssetMap.TryGetValue(Key, out value) || !value.Asset || value.RefCount == 0)
     {
         CString cstring = StringManager.Instance.StaticString1024();
         if (!value.Internal)
         {
             cstring.StringToFormat(Application.dataPath);
             cstring.StringToFormat(Name);
             cstring.AppendFormat("{0}!assets/{1}.unity3d");
         }
         else
         {
             cstring.StringToFormat(AssetManager.persistentDataPath);
             cstring.StringToFormat(Name);
             cstring.AppendFormat("{0}/{1}.unity3d");
         }
         value.Set(AssetBundle.CreateFromFile(cstring.ToString()));
     }
     value.RefCount++;
     AssetManager.AssetMap[Key] = value;
     return(value.Asset);
 }
Пример #2
0
    // Token: 0x06000FBC RID: 4028 RVA: 0x001B7620 File Offset: 0x001B5820
    private void UpdateRallyAttack(ref WarlobbyData Data)
    {
        DataManager instance = DataManager.Instance;

        this.TopText.text    = instance.mStringTable.GetStringByID(4879u);
        Data.AttackOrDefense = 0;
        GUIManager.Instance.ChangeHeroItemImg(this.TopHero, eHeroOrItem.Hero, Data.EnemyHead, 11, 0, 0);
        if (Data.EnemyHead > 0)
        {
            this.TopHero.gameObject.SetActive(true);
        }
        if (Data.EnemyHomeKingdom == 0 || DataManager.MapDataController.kingdomData.kingdomID == Data.EnemyHomeKingdom)
        {
            this.TopCountry.SetActive(false);
        }
        else
        {
            this.TopCountry.SetActive(true);
            base.SetText(Rally.TextType.TopCountry, (int)Data.EnemyHomeKingdom, null, 0, null, 0);
        }
        base.SetText(Rally.TextType.TopName, 0, Data.EnemyName, 0, Data.EnemyAllianceTag, Data.EnemyHomeKingdom);
        if (Data.AllyNameID != 0)
        {
            this.LeftBar.gameObject.SetActive(true);
            this.LeftBar.SetTimebar(base.GetTroopKind(), Data.EventTime.BeginTime, Data.EventTime.BeginTime + (long)((ulong)Data.EventTime.RequireTime), 0L);
        }
        GUIManager.Instance.ChangeHeroItemImg(this.LeftHero, eHeroOrItem.Hero, Data.AllyHead, 11, 0, 0);
        if (Data.AllyHead > 0)
        {
            this.LeftHero.gameObject.SetActive(true);
        }
        base.SetText(Rally.TextType.LeftName, 0, Data.AllyName, 0, null, 0);
        this.TopHeroBtn.m_BtnID1       = GameConstants.PointCodeToMapID(Data.EnemyCapitalPoint.zoneID, Data.EnemyCapitalPoint.pointID);
        this.TopHeroBtn.m_BtnID2       = (int)DataManager.MapDataController.OtherKingdomData.kingdomID;
        this.LeftHeroBtn.m_BtnID1      = GameConstants.PointCodeToMapID(Data.AllyCapitalPoint.zoneID, Data.AllyCapitalPoint.pointID);
        this.LeftHeroBtn.m_BtnID2      = (int)DataManager.MapDataController.OtherKingdomData.kingdomID;
        this.TopUnderLineBtn.m_BtnID2  = GameConstants.PointCodeToMapID(Data.EnemyCapitalPoint.zoneID, Data.EnemyCapitalPoint.pointID);
        this.TopUnderLineBtn.m_BtnID3  = (int)DataManager.MapDataController.OtherKingdomData.kingdomID;
        this.LeftUnderLineBtn.m_BtnID2 = GameConstants.PointCodeToMapID(Data.AllyCapitalPoint.zoneID, Data.AllyCapitalPoint.pointID);
        this.LeftUnderLineBtn.m_BtnID3 = (int)DataManager.MapDataController.OtherKingdomData.kingdomID;
        Vector2 sizeDelta = this.TopUnderLine.sizeDelta;

        sizeDelta.x = Math.Min(this.TopNameText.preferredWidth, 362f);
        this.TopUnderLine.sizeDelta = sizeDelta;
        if (GUIManager.Instance.IsArabic)
        {
            RectTransform rectTransform = this.TopUnderLine.transform as RectTransform;
            rectTransform.anchoredPosition = new Vector2(this.TopNameText.rectTransform.sizeDelta.x - this.TopNameText.preferredWidth, rectTransform.anchoredPosition.y);
        }
        this.TopUnderLine.gameObject.SetActive(true);
        sizeDelta = this.LeftUnderLine.sizeDelta;
        if (this.LeftNameText.preferredWidth > 245f)
        {
            this.LeftNameText.fontSize = 19;
            this.LeftNameText.SetAllDirty();
            this.LeftNameText.cachedTextGeneratorForLayout.Invalidate();
        }
        sizeDelta.x = Math.Min(this.LeftNameText.preferredWidth, 245f);
        this.LeftUnderLine.sizeDelta = sizeDelta;
        this.LeftUnderLine.gameObject.SetActive(true);
        int num = this.ItemsHeight.Count - instance.WarTroop.Count;

        if (num < 0)
        {
            short num2 = 0;
            while ((int)num2 > num)
            {
                this.ItemsHeight.Add(80f);
                this.ItemsExtend.Add(0);
                num2 -= 1;
            }
        }
        else if (num > 0)
        {
            if (WarlobbyTroop.DelIndex != 255 && (int)WarlobbyTroop.DelIndex < this.ItemsExtend.Count)
            {
                this.ItemsHeight.RemoveAt((int)WarlobbyTroop.DelIndex);
                this.ItemsExtend.RemoveAt((int)WarlobbyTroop.DelIndex);
                WarlobbyTroop.DelIndex = byte.MaxValue;
                num--;
            }
            byte b = 0;
            while ((int)b < num)
            {
                this.ItemsHeight.RemoveAt(0);
                this.ItemsExtend.RemoveAt(0);
                b += 1;
            }
        }
        bool flag = false;

        if (Data.EventTime.BeginTime + (long)((ulong)Data.EventTime.RequireTime) < instance.ServerTime)
        {
            flag = true;
        }
        if (Data.Kind == 1)
        {
            this.LeftBar.transform.anchoredPosition = new Vector2(-6.6f, this.LeftBar.transform.anchoredPosition.y);
            this.RallySpeedupBtn.gameObject.SetActive(true);
        }
        else
        {
            this.LeftBar.transform.anchoredPosition = new Vector2(17.2f, this.LeftBar.transform.anchoredPosition.y);
            this.RallySpeedupBtn.gameObject.SetActive(false);
        }
        int hashCode = instance.RoleAttr.Name.GetHashCode(false);

        if (Data.AllyNameID == 0)
        {
            this.LeftCancelImg.gameObject.SetActive(false);
            this.LeftJoinImg.gameObject.SetActive(false);
        }
        else if (hashCode == Data.AllyNameID || this.bShowAttackbtn)
        {
            this.LeftCancelImg.gameObject.SetActive(true);
            this.FilterBtn.gameObject.SetActive(true);
            this.LeftJoinImg.gameObject.SetActive(false);
            this.LeftCancelImg.rectTransform.anchoredPosition = new Vector2(131.5f, -319.5f);
        }
        else
        {
            this.LeftCancelImg.gameObject.SetActive(false);
            this.FilterBtn.gameObject.SetActive(false);
            if (!flag && Data.Kind == 0)
            {
                CString cstring = StringManager.Instance.StaticString1024();
                bool    flag2   = false;
                for (byte b2 = 0; b2 < instance.MaxMarchEventNum; b2 += 1)
                {
                    if (instance.MarchEventData[(int)b2].Type == EMarchEventType.EMET_RallyMarching || instance.MarchEventData[(int)b2].Type == EMarchEventType.EMET_RallyStanby)
                    {
                        cstring.ClearString();
                        cstring.Append(instance.MarchEventData[(int)b2].DesPlayerName);
                        if (cstring.GetHashCode(false) == Data.AllyNameID)
                        {
                            flag2 = true;
                            break;
                        }
                    }
                }
                if (!flag2)
                {
                    this.LeftJoinText.text  = instance.mStringTable.GetStringByID(4884u);
                    this.LeftJoinText.color = Color.white;
                    this.JoinBtn.enabled    = true;
                }
                else
                {
                    this.LeftJoinText.text  = instance.mStringTable.GetStringByID(4913u);
                    this.LeftJoinText.color = Color.red;
                    this.JoinBtn.enabled    = false;
                }
                this.LeftJoinImg.gameObject.SetActive(true);
            }
            else
            {
                this.LeftJoinImg.gameObject.SetActive(false);
            }
        }
        if (this.ItemsHeight.Count > 0)
        {
            this.RightMessage.gameObject.SetActive(false);
            this.RallyScroll.gameObject.SetActive(true);
            this.RallyScroll.AddNewDataHeight(this.ItemsHeight, true, true);
            this.RallyScroll.GoTo(this.LoadBeginIndex, this.LoadContY);
        }
        else
        {
            this.RightMessage.gameObject.SetActive(true);
            this.RallyScroll.gameObject.SetActive(false);
        }
        Data.AllyCurrTroop = 0u;
        for (int i = 0; i < instance.WarTroop.Count; i++)
        {
            if (instance.WarTroop[i] != null)
            {
                Data.AllyCurrTroop += instance.WarTroop[i].TotalTroopNum;
            }
        }
        CString cstring2 = StringManager.Instance.StaticString1024();

        cstring2.StringToFormat(instance.mStringTable.GetStringByID(4889u));
        cstring2.AppendFormat("{0} : ");
        base.SetText(Rally.TextType.RightTitle, (int)Data.AllyCurrTroop, cstring2, (int)Data.AllyMAXTroop, null, 0);
        this.ArmyStatisticHint.Show(null);
    }
Пример #3
0
    // Token: 0x06000158 RID: 344 RVA: 0x00015DF8 File Offset: 0x00013FF8
    public static bool GetAssetBundleDownload(CString Name, AssetPath Path, AssetType Type, ushort Id, bool DontUpdate = false)
    {
        bool flag     = false;
        int  hashCode = Name.GetHashCode(true);

        AssetManager.AssRef assRef;
        if (!AssetManager.AssetMap.TryGetValue(hashCode, out assRef))
        {
            AssetManager.SetAssetBundle(hashCode, 0L, true);
            assRef.Internal = true;
        }
        else if (assRef.Asset)
        {
            flag = true;
        }
        if (!flag)
        {
            CString cstring = StringManager.Instance.StaticString1024();
            if (!assRef.Internal)
            {
                cstring.StringToFormat(Application.dataPath);
                cstring.StringToFormat(Name);
                cstring.AppendFormat("{0}!assets/{1}.unity3d");
            }
            else
            {
                cstring.StringToFormat(AssetManager.persistentDataPath);
                cstring.StringToFormat(Name);
                cstring.AppendFormat("{0}/{1}.unity3d");
            }
            if (assRef.Asset = AssetBundle.CreateFromFile(cstring.ToString()))
            {
                assRef.Asset.Unload(true);
                flag = true;
            }
        }
        if (DontUpdate && flag)
        {
            return(true);
        }
        if (Path == AssetPath.Store)
        {
            if (Type == AssetType.MallBack)
            {
                AssetManager.RequestMallBundle(Id, false);
            }
            else if (Type == AssetType.MallPackage)
            {
                AssetManager.RequestMallPackage(Id, false);
            }
        }
        else if (Path == AssetPath.Activity)
        {
            if (Type == AssetType.ActivityBack)
            {
                AssetManager.RequestActivityBundle(Id, false);
            }
            else if (Type == AssetType.ActivityPackage)
            {
                AssetManager.RequestActivityPackage(Id, false);
            }
        }
        else
        {
            AssetManager.DownloadAssetBundle(Name, Path, Type, Id, false);
        }
        return(flag);
    }
Пример #4
0
    // Token: 0x06000184 RID: 388 RVA: 0x00017FA8 File Offset: 0x000161A8
    public void LoadAndPlayBGM(BGMType Type, byte Loop = 1, bool Force = false)
    {
        if (this.www != null)
        {
            if (this.CurMusicType == Type)
            {
                return;
            }
            this.www.Dispose();
            this.www = null;
            Resources.UnloadUnusedAssets();
        }
        this.CurMusicType = Type;
        if (!DataManager.Instance.MySysSetting.bMusic && !Force)
        {
            if (this.BGMSource[this.BGMmainIndex].clip != null)
            {
                UnityEngine.Object.Destroy(this.BGMSource[this.BGMmainIndex].clip);
                this.BGMSource[this.BGMmainIndex].clip = null;
                this.BGMClip.clip = null;
                this.BGMassetBundle[this.BGMmainIndex].Unload(true);
                this.BGMassetBundle[this.BGMmainIndex] = null;
                this.NowPlayBGMName = 0;
            }
            return;
        }
        if (this.bCrossfade)
        {
            this.FadeTime = this.FadeTimeMax + 1f;
            this.UpdateCrossfade();
        }
        CString cstring = StringManager.Instance.StaticString1024();

        cstring.ClearString();
        CString tmpS     = StringManager.Instance.StaticString1024();
        CString cstring2 = StringManager.Instance.StaticString1024();

        cstring2.StringToFormat(tmpS);
        cstring2.StringToFormat(Application.streamingAssetsPath);
        switch (this.CurMusicType)
        {
        case BGMType.Main:
            cstring2.StringToFormat(this.Path);
            cstring.Append("BGM10");
            break;

        case BGMType.Legion:
            if (DataManager.Instance.MySysSetting.mMusicSelect == 0)
            {
                cstring2.StringToFormat(this.Path);
                cstring.Append("BGM02");
            }
            else
            {
                cstring2.StringToFormat(this.Path);
                cstring.Append("BGM07");
            }
            break;

        case BGMType.WarVictory:
            cstring2.StringToFormat(this.Path);
            cstring.Append("BGM03");
            break;

        case BGMType.WarDefeat:
            cstring2.StringToFormat(this.Path);
            cstring.Append("BGM04");
            break;

        case BGMType.War:
            cstring2.StringToFormat(this.Path);
            cstring.Append("War01");
            break;

        case BGMType.LegionWar:
        case BGMType.Login:
            cstring2.StringToFormat("Loading/");
            cstring.Append("War02");
            break;

        case BGMType.LegionVictory:
            cstring2.StringToFormat(this.Path);
            cstring.Append("BGM05");
            break;

        case BGMType.LegionDefeat:
            cstring2.StringToFormat(this.Path);
            cstring.Append("BGM06");
            break;

        case BGMType.Master:
            cstring2.StringToFormat(this.Path);
            cstring.Append("BGM10");
            break;

        case BGMType.Newie:
            cstring2.StringToFormat(this.Path);
            cstring.Append("BGM02");
            break;
        }
        cstring2.StringToFormat(cstring);
        cstring2.AppendFormat("{0}{1}/{2}{3}.unity3d");
        this.BGMLoop = Loop;
        if (this.NowPlayBGMName == cstring2.GetHashCode(false))
        {
            if (!this.BGMSource[this.BGMmainIndex].isPlaying)
            {
                this.BGMSource[this.BGMmainIndex].loop = (this.BGMLoop == 1);
                this.BGMSource[this.BGMmainIndex].Play();
                this.BGMSource[this.BGMmainIndex].volume = this.BaseVol;
            }
            return;
        }
        this.www = new WWW(cstring2.ToString());
    }