Example #1
0
        public void Show()
        {
            this._root.CustomSetActive(true);
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat.ContainsKey(1u))
            {
                this.validateScore(1, campStat.get_Item(1u).campScore, campStat.get_Item(1u).HeadPoints);
            }
            if (campStat.ContainsKey(2u))
            {
                this.validateScore(2, campStat.get_Item(2u).campScore, campStat.get_Item(2u).HeadPoints);
            }
        }
Example #2
0
    public void Event_ApplicationPause(bool pause)
    {
        if (Singleton <BattleLogic> .get_instance().isRuning)
        {
            return;
        }
        List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

        list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
        list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
        list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
        list.Add(new KeyValuePair <string, string>("openid", "NULL"));
        list.Add(new KeyValuePair <string, string>("GameType", Singleton <GameBuilder> .GetInstance().m_kGameType.ToString()));
        list.Add(new KeyValuePair <string, string>("MapID", Singleton <GameBuilder> .GetInstance().m_iMapId.ToString()));
        list.Add(new KeyValuePair <string, string>("Status", pause.ToString()));
        if (pause)
        {
            BeaconHelper.m_Time = Time.time;
            list.Add(new KeyValuePair <string, string>("PauseTime", string.Empty));
        }
        else
        {
            list.Add(new KeyValuePair <string, string>("PauseTime", (Time.time - BeaconHelper.m_Time).ToString()));
            BeaconHelper.m_Time = 0f;
        }
        string text  = string.Empty;
        string text2 = string.Empty;

        if (Singleton <BattleLogic> .get_instance().isRuning&& Singleton <BattleLogic> .GetInstance().battleStat != null)
        {
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat != null)
            {
                if (campStat.ContainsKey(1u) && Singleton <GamePlayerCenter> .get_instance().GetHostPlayer() != null && Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().PlayerCamp == 1)
                {
                    text = campStat.get_Item(1u).campScore.ToString();
                }
                if (campStat.ContainsKey(2u))
                {
                    text2 = campStat.get_Item(2u).campScore.ToString();
                }
            }
        }
        list.Add(new KeyValuePair <string, string>("MyScore", text));
        list.Add(new KeyValuePair <string, string>("EnemyScore", text2));
        list.Add(new KeyValuePair <string, string>("RoomID", string.Empty));
        Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_ApplicationPause", list, true);
    }
Example #3
0
        public void RegiseterEvent()
        {
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat.ContainsKey(1u))
            {
                campStat.get_Item(1u).onCampScoreChanged += new CampInfo.CampInfoValueChanged(this.validateScore);
            }
            if (campStat.ContainsKey(2u))
            {
                campStat.get_Item(2u).onCampScoreChanged += new CampInfo.CampInfoValueChanged(this.validateScore);
            }
            Singleton <EventRouter> .get_instance().AddEventHandler(EventID.BATTLE_KDA_CHANGED, new Action(this.OnBattleKDAChanged));

            Singleton <EventRouter> .get_instance().AddEventHandler(EventID.BATTLE_KDA_CHANGED_BY_ACTOR_DEAD, new Action(this.OnBattleKDAChangedByActorDead));
        }
Example #4
0
        public void Clear()
        {
            int num  = this._duration / 60;
            int num2 = this._duration - num * 60;

            if (num2 < 0)
            {
                num2 = 0;
            }
            string   duration  = string.Format("{0:D2}:{1:D2}", num, num2);
            DateTime dateTime  = Utility.ToUtcTime2Local((long)this._startTime);
            string   startTime = string.Format("{0:D4}/{1:D2}/{2:D2} {3:D2}:{4:D2}", new object[]
            {
                dateTime.get_Year(),
                dateTime.get_Month(),
                dateTime.get_Day(),
                dateTime.get_Hour(),
                dateTime.get_Minute()
            });

            Singleton <SettlementSystem> .get_instance().SetLastMatchDuration(duration, startTime, (uint)this._startTime);

            this._duration  = 0;
            this._startTime = 0;
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat.ContainsKey(1u))
            {
                campStat.get_Item(1u).onCampScoreChanged -= new CampInfo.CampInfoValueChanged(this.validateScore);
            }
            if (campStat.ContainsKey(2u))
            {
                campStat.get_Item(2u).onCampScoreChanged -= new CampInfo.CampInfoValueChanged(this.validateScore);
            }
            Singleton <EventRouter> .get_instance().RemoveEventHandler(EventID.BATTLE_KDA_CHANGED, new Action(this.OnBattleKDAChanged));

            Singleton <EventRouter> .get_instance().RemoveEventHandler(EventID.BATTLE_KDA_CHANGED_BY_ACTOR_DEAD, new Action(this.OnBattleKDAChangedByActorDead));

            this._root        = null;
            this._leftScore   = null;
            this._rightScore  = null;
            this._txtTime     = null;
            this.levelContext = null;
            this.m_kingActor.Release();
            this.m_lastMostKill = 0;
        }
Example #5
0
        protected override void OnClose()
        {
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat.ContainsKey(this.SubjCamp))
            {
                CampInfo campInfo = campStat.get_Item(this.SubjCamp);
                campInfo.onCampScoreChanged -= new CampInfo.CampInfoValueChanged(this.ValidateKill);
            }
        }
Example #6
0
 public CNamedEvent FindEventStatic(string eventName, string className)
 {
     if (this.ms_eventInfosGlobal.ContainsKey(className))
     {
         DictionaryView <CStringID, CNamedEvent> dictionaryView = this.ms_eventInfosGlobal.get_Item(className);
         CStringID cStringID = new CStringID(eventName);
         if (dictionaryView.ContainsKey(cStringID))
         {
             return(dictionaryView.get_Item(cStringID));
         }
     }
     return(null);
 }
Example #7
0
 public int CalcDamageAddition(uint attackerMark, uint suffererMark)
 {
     if (this._dataDict != null && this._dataDict.ContainsKey(attackerMark))
     {
         DictionaryView <uint, ResClashAddition> dictionaryView = this._dataDict.get_Item(attackerMark);
         if (dictionaryView.ContainsKey(suffererMark))
         {
             ResClashAddition resClashAddition = dictionaryView.get_Item(suffererMark);
             return(Singleton <BattleLogic> .GetInstance().dynamicProperty.GetDynamicDamage(resClashAddition.dwDynamicConfig, (int)resClashAddition.dwDamageAddition));
         }
     }
     return(10000);
 }
Example #8
0
        private bool Pack(int size)
        {
            int     num  = 0;
            int     num2 = 0;
            int     num3 = 0;
            int     num4 = this.padding;
            Vector2 zero = Vector2.zero;
            DictionaryView <int, AtlasInfo.UVDetail> dictionaryView = new DictionaryView <int, AtlasInfo.UVDetail>();

            DictionaryView <int, AtlasInfo.UVDetail> .Enumerator enumerator = this.textures.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KeyValuePair <int, AtlasInfo.UVDetail> current = enumerator.get_Current();
                int width = current.get_Value().width;
                KeyValuePair <int, AtlasInfo.UVDetail> current2 = enumerator.get_Current();
                int height = current2.get_Value().height;
                AtlasInfo.UVDetail uVDetail = new AtlasInfo.UVDetail();
                uVDetail.rotate = false;
                DictionaryView <int, AtlasInfo.UVDetail> arg_7E_0 = dictionaryView;
                KeyValuePair <int, AtlasInfo.UVDetail>   current3 = enumerator.get_Current();
                arg_7E_0.Add(current3.get_Key(), uVDetail);
                if (num3 + height + num4 <= size && num2 + width + num4 <= size)
                {
                    uVDetail.x      = num2;
                    uVDetail.y      = num3;
                    uVDetail.width  = width;
                    uVDetail.height = height;
                    num3           += height + num4;
                    if (num < num2 + width + num4)
                    {
                        num = num2 + width + num4;
                    }
                }
                else
                {
                    if (num + width > size || height > size)
                    {
                        return(false);
                    }
                    num2            = num;
                    uVDetail.x      = num2;
                    uVDetail.y      = 0;
                    uVDetail.width  = width;
                    uVDetail.height = height;
                    num3            = height + num4;
                    num             = num2 + width + num4;
                }
            }
            TextureFormat textureFormat = TextureFormat.ARGB32;

            if (this.needCompress)
            {
                textureFormat = TextureFormat.ARGB32;
            }
            Texture2D texture2D = new Texture2D(size, size, textureFormat, false);

            Color[] pixels = new Color[texture2D.width * texture2D.height];
            texture2D.SetPixels(pixels);
            texture2D.name = string.Concat(new object[]
            {
                "Auto_UI3D_Atlas_",
                size,
                "_",
                this.counter,
                "_format",
                textureFormat.ToString()
            });
            this.counter++;
            enumerator.Reset();
            while (enumerator.MoveNext())
            {
                Texture2D texture2D2 = null;
                Dictionary <int, Texture2D>            arg_1F2_0 = this.waitForCombineTextures;
                KeyValuePair <int, AtlasInfo.UVDetail> current4  = enumerator.get_Current();
                if (!arg_1F2_0.TryGetValue(current4.get_Key(), ref texture2D2))
                {
                    texture2D2 = this.atlas;
                }
                KeyValuePair <int, AtlasInfo.UVDetail> current5 = enumerator.get_Current();
                AtlasInfo.UVDetail value = current5.get_Value();
                DictionaryView <int, AtlasInfo.UVDetail> arg_228_0 = dictionaryView;
                KeyValuePair <int, AtlasInfo.UVDetail>   current6  = enumerator.get_Current();
                AtlasInfo.UVDetail uVDetail2 = arg_228_0.get_Item(current6.get_Key());
                Color[]            pixels2   = texture2D2.GetPixels(value.x, value.y, value.width, value.height);
                texture2D.SetPixels(uVDetail2.x, uVDetail2.y, value.width, value.height, pixels2);
                texture2D.Apply(false, false);
                uVDetail2.uvTL = new Vector2((float)uVDetail2.x / (float)texture2D.width, (float)(uVDetail2.y + uVDetail2.height) / (float)texture2D.height);
                uVDetail2.uvTR = new Vector2((float)(uVDetail2.x + uVDetail2.width) / (float)texture2D.width, (float)(uVDetail2.y + uVDetail2.height) / (float)texture2D.height);
                uVDetail2.uvBL = new Vector2((float)uVDetail2.x / (float)texture2D.width, (float)uVDetail2.y / (float)texture2D.height);
                uVDetail2.uvBR = new Vector2((float)(uVDetail2.x + uVDetail2.width) / (float)texture2D.width, (float)uVDetail2.y / (float)texture2D.height);
            }
            this.textures = dictionaryView;
            Object.Destroy(this.atlas);
            this.atlas = texture2D;
            Shader shader = Singleton <CResourceManager> .GetInstance().GetResource("Shaders/UI/UI3D.shader", typeof(Shader), 0, true, true).m_content as Shader;

            this.mat = new Material(shader);
            this.mat.SetTexture("_MainTex", this.atlas);
            HashSet <Sprite3D> .Enumerator enumerator2 = this.sprites.GetEnumerator();
            while (enumerator2.MoveNext())
            {
                enumerator2.get_Current().SetMaterial(this.mat);
                enumerator2.get_Current().SetAutoAtlas(this.atlas, this.textures.get_Item(enumerator2.get_Current().m_textureGUID));
            }
            Dictionary <int, Texture2D> .Enumerator enumerator3 = this.waitForCombineTextures.GetEnumerator();
            this.waitForCombineTextures.Clear();
            Singleton <CResourceManager> .GetInstance().UnloadUnusedAssets();

            return(true);
        }
Example #9
0
        private static object FromStringStruct(Type type, string src)
        {
            object obj = Activator.CreateInstance(type);
            DictionaryView <string, FieldInfo> dictionaryView = new DictionaryView <string, FieldInfo>();

            FieldInfo[] fields = type.GetFields(62);
            for (int i = 0; i < fields.Length; i++)
            {
                FieldInfo fieldInfo = fields[i];
                if (!fieldInfo.get_IsLiteral())
                {
                    dictionaryView.Add(fieldInfo.get_Name(), fieldInfo);
                }
            }
            if (string.IsNullOrEmpty(src))
            {
                return(obj);
            }
            int num  = StringUtils.SkipPairedBrackets(src, 0);
            int num2 = 1;
            int num3 = src.IndexOf(';', num2);

            while (num3 != -1)
            {
                if (num3 > num2)
                {
                    int    num4 = src.IndexOf('=', num2);
                    int    num5 = num4 - num2;
                    string text = src.Substring(num2, num5);
                    char   c    = src.get_Chars(num4 + 1);
                    string valStr;
                    if (c != '{')
                    {
                        num5   = num3 - num4 - 1;
                        valStr = src.Substring(num4 + 1, num5);
                    }
                    else
                    {
                        int num6 = 0;
                        num6 += num4 + 1;
                        int num7 = StringUtils.SkipPairedBrackets(src, num6);
                        num5   = num7 - num6 + 1;
                        valStr = src.Substring(num4 + 1, num5);
                        num3   = num4 + 1 + num5;
                    }
                    if (dictionaryView.ContainsKey(text))
                    {
                        FieldInfo fieldInfo2 = dictionaryView.get_Item(text);
                        object    obj2       = StringUtils.FromString(fieldInfo2.get_FieldType(), valStr, false);
                        fieldInfo2.SetValue(obj, obj2);
                    }
                }
                num2 = num3 + 1;
                num3 = src.IndexOf(';', num2);
                if (num3 > num)
                {
                    break;
                }
            }
            return(obj);
        }
Example #10
0
        public static ListView <UrlAction> ParseFromText(string text, char[] spliter = null)
        {
            ListView <UrlAction> listView = new ListView <UrlAction>();

            if (spliter == null)
            {
                spliter = UrlAction.MultiSpliter;
            }
            try
            {
                string[] array = text.Split(spliter, 1);
                for (int i = 0; i < array.Length; i++)
                {
                    string[] array2 = array[i].Split(UrlAction.InnerSpliter, 1);
                    if (array2.Length > 0)
                    {
                        DictionaryView <string, string> dictionaryView = new DictionaryView <string, string>();
                        for (int j = 1; j < array2.Length; j++)
                        {
                            string[] array3 = array2[j].Split(UrlAction.ParamSpliter);
                            if (array3 != null && array3.Length == 2)
                            {
                                dictionaryView.Add(array3[0], array3[1]);
                            }
                        }
                        UrlAction urlAction = new UrlAction();
                        urlAction.target = array2[0];
                        urlAction.action = UrlAction.Action.none;
                        if (dictionaryView.ContainsKey("action"))
                        {
                            string text2 = dictionaryView.get_Item("action");
                            string text3 = text2;
                            if (text3 != null)
                            {
                                if (UrlAction.< > f__switch$map0 == null)
                                {
                                    Dictionary <string, int> dictionary = new Dictionary <string, int>(3);
                                    dictionary.Add("openUrl", 0);
                                    dictionary.Add("openForm", 1);
                                    dictionary.Add("buy", 2);
                                    UrlAction.< > f__switch$map0 = dictionary;
                                }
                                int num;
                                if (UrlAction.< > f__switch$map0.TryGetValue(text3, ref num))
                                {
                                    switch (num)
                                    {
                                    case 0:
                                        urlAction.action = UrlAction.Action.openUrl;
                                        urlAction.url    = dictionaryView.get_Item("url");
                                        break;

                                    case 1:
                                        urlAction.action = UrlAction.Action.openForm;
                                        urlAction.form   = int.Parse(dictionaryView.get_Item("form"));
                                        break;

                                    case 2:
                                        urlAction.action   = UrlAction.Action.buy;
                                        urlAction.prodType = int.Parse(dictionaryView.get_Item("prodType"));
                                        urlAction.prodID   = uint.Parse(dictionaryView.get_Item("prodID"));
                                        if (dictionaryView.ContainsKey("prodSpec"))
                                        {
                                            int.TryParse(dictionaryView.get_Item("prodSpec"), ref urlAction.prodSpec);
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                        if (dictionaryView.ContainsKey("overTime"))
                        {
                            ulong.TryParse(dictionaryView.get_Item("overTime"), ref urlAction.overTime);
                        }
                        if (dictionaryView.ContainsKey("showTime"))
                        {
                            int.TryParse(dictionaryView.get_Item("showTime"), ref urlAction.showTime);
                        }
                        listView.Add(urlAction);
                    }
                }
            }
            catch (Exception var_9_25C)
            {
            }
            return(listView);
        }