Ejemplo n.º 1
0
        public void Clear()
        {
            int num  = this._duration / 60;
            int num2 = this._duration - (num * 60);

            if (num2 < 0)
            {
                num2 = 0;
            }
            string timeStr = string.Format("{0:D2}:{1:D2}", num, num2);

            Singleton <SettlementSystem> .instance.SetLastMatchDuration(timeStr);

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

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

            this._root        = null;
            this._leftScore   = null;
            this._rightScore  = null;
            this._txtTime     = null;
            this.levelContext = null;
            this.m_kingActor.Release();
            this.m_lastMostKill = 0;
        }
Ejemplo n.º 2
0
        public static BehaviorTreeTask CreateBehaviorTreeTask(string relativePath)
        {
            BehaviorTree tree = null;

            if (BehaviorTrees.ContainsKey(relativePath))
            {
                tree = BehaviorTrees[relativePath];
            }
            else if (Load(relativePath))
            {
                tree = BehaviorTrees[relativePath];
            }
            if (tree == null)
            {
                return(null);
            }
            BehaviorTreeTask item = tree.CreateAndInitTask() as BehaviorTreeTask;

            if (!ms_allBehaviorTreeTasks.ContainsKey(relativePath))
            {
                ms_allBehaviorTreeTasks[relativePath] = new BTItem_t();
            }
            BTItem_t _t = ms_allBehaviorTreeTasks[relativePath];

            if (!_t.bts.Contains(item))
            {
                _t.bts.Add(item);
            }
            return(item);
        }
Ejemplo n.º 3
0
        public static Property Create(string typeName, string variableName, string value, bool bStatic, bool bConst)
        {
            if (!bConst)
            {
                string str  = null;
                string str2 = null;
                bool   flag = Utils.IsParVar(variableName);
                if (flag)
                {
                    str2 = string.Format("{0}::{1}", typeName, variableName);
                }
                else
                {
                    str2 = ParseInstanceNameProperty(variableName, ref str);
                }
                bool flag2 = false;
                if (!string.IsNullOrEmpty(str2))
                {
                    flag2 = ms_properties.ContainsKey(str2);
                }
                if (!flag2)
                {
                    Property property = create(flag, bConst, typeName, str2, str, value);
                    if (!string.IsNullOrEmpty(str2))
                    {
                        ms_properties[str2] = property;
                    }
                    return(property.clone());
                }
                Property property4 = ms_properties[str2].clone();
                if (!string.IsNullOrEmpty(value) && !IsAgentPtr(typeName, value))
                {
                    property4.SetDefaultValue(value);
                }
                return(property4);
            }
            CMemberBase base2        = null;
            bool        flag4        = !string.IsNullOrEmpty(variableName);
            string      instanceName = null;
            string      propertyName = variableName;

            if (flag4)
            {
                propertyName = ParseInstanceNameProperty(variableName, ref instanceName);
                base2        = Agent.FindMemberBase(propertyName);
            }
            if (base2 != null)
            {
                return(base2.CreateProperty(value, true));
            }
            bool bParVar = flag4 && Utils.IsParVar(variableName);

            return(create(bParVar, bConst, typeName, propertyName, instanceName, value));
        }
Ejemplo n.º 4
0
        public void Show()
        {
            this._root.CustomSetActive(true);
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat.ContainsKey(1))
            {
                this.validateScore(COM_PLAYERCAMP.COM_PLAYERCAMP_1, campStat[1].campScore, campStat[1].HeadPoints);
            }
            if (campStat.ContainsKey(2))
            {
                this.validateScore(COM_PLAYERCAMP.COM_PLAYERCAMP_2, campStat[2].campScore, campStat[2].HeadPoints);
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        public void RegiseterEvent()
        {
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat.ContainsKey(1))
            {
                campStat[1].onCampScoreChanged += new CampInfo.CampInfoValueChanged(this.validateScore);
            }
            if (campStat.ContainsKey(2))
            {
                campStat[2].onCampScoreChanged += new CampInfo.CampInfoValueChanged(this.validateScore);
            }
            Singleton <EventRouter> .instance.AddEventHandler(EventID.BATTLE_KDA_CHANGED, new Action(this, (IntPtr)this.OnBattleKDAChanged));
        }
Ejemplo n.º 7
0
 public static void Cleanup(int contextId)
 {
     if (ms_contexts != null)
     {
         if (contextId == -1)
         {
             ms_contexts.Clear();
         }
         else if (ms_contexts.ContainsKey(contextId))
         {
             ms_contexts.Remove(contextId);
         }
     }
 }
Ejemplo n.º 8
0
    public void Event_ApplicationPause(bool pause)
    {
        if (Singleton <BattleLogic> .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> .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> .instance.GetHostPlayer() != null && Singleton <GamePlayerCenter> .instance.GetHostPlayer().PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1)
                {
                    text = campStat[1u].campScore.ToString();
                }
                if (campStat.ContainsKey(2u))
                {
                    text2 = campStat[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);
    }
Ejemplo n.º 9
0
 private void AddAction(DictionaryView <string, Action> actions, string actionName)
 {
     if (actionName != null && !this.actionDict.ContainsKey(actionName) && !actions.ContainsKey(actionName))
     {
         actions.Add(actionName, null);
     }
 }
Ejemplo n.º 10
0
 public static ListView <ResHeroSkin> GetAvailableSkinByHeroId(uint heroId)
 {
     s_availableSkin.Clear();
     if (s_heroSkinDic.ContainsKey(heroId))
     {
         ListView <ResHeroSkin> view = s_heroSkinDic[heroId];
         for (int i = 0; i < view.Count; i++)
         {
             if (GameDataMgr.IsSkinAvailable(view[i].dwID))
             {
                 s_availableSkin.Add(view[i]);
             }
         }
     }
     return(s_availableSkin);
 }
Ejemplo n.º 11
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));
        }
Ejemplo n.º 12
0
    public void Event_ApplicationPause(bool pause)
    {
        List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
            new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
            new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
            new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
            new KeyValuePair <string, string>("openid", "NULL"),
            new KeyValuePair <string, string>("GameType", Singleton <GameBuilder> .GetInstance().m_kGameType.ToString()),
            new KeyValuePair <string, string>("MapID", Singleton <GameBuilder> .GetInstance().m_iMapId.ToString()),
            new KeyValuePair <string, string>("Status", pause.ToString())
        };

        if (pause)
        {
            m_Time = Time.time;
            events.Add(new KeyValuePair <string, string>("PauseTime", string.Empty));
        }
        else
        {
            float num = Time.time - m_Time;
            events.Add(new KeyValuePair <string, string>("PauseTime", num.ToString()));
            m_Time = 0f;
        }
        string str  = string.Empty;
        string str2 = string.Empty;

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

            if (campStat != null)
            {
                if ((campStat.ContainsKey(1) && (Singleton <GamePlayerCenter> .instance.GetHostPlayer() != null)) && (Singleton <GamePlayerCenter> .instance.GetHostPlayer().PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1))
                {
                    str = campStat[1].campScore.ToString();
                }
                if (campStat.ContainsKey(2))
                {
                    str2 = campStat[2].campScore.ToString();
                }
            }
        }
        events.Add(new KeyValuePair <string, string>("MyScore", str));
        events.Add(new KeyValuePair <string, string>("EnemyScore", str2));
        events.Add(new KeyValuePair <string, string>("RoomID", string.Empty));
        Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_ApplicationPause", events, true);
    }
Ejemplo n.º 13
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;
        }
Ejemplo n.º 14
0
    private void AddReferencedAssets(DictionaryView <string, AGE.Action> actions, Dictionary <object, AssetRefType> actionAssets)
    {
        Dictionary <object, AssetRefType> .Enumerator enumerator = actionAssets.GetEnumerator();
        while (enumerator.MoveNext())
        {
            KeyValuePair <object, AssetRefType> current = enumerator.Current;
            AssetRefType type = current.Value;
            switch (type)
            {
            case AssetRefType.Action:
            {
                KeyValuePair <object, AssetRefType> pair2 = enumerator.Current;
                string key = pair2.Key as string;
                if (!this.actionDict.ContainsKey(key) && !actions.ContainsKey(key))
                {
                    actions.Add(key, null);
                }
                continue;
            }

            case AssetRefType.SkillID:
            {
                KeyValuePair <object, AssetRefType> pair5 = enumerator.Current;
                int skillID = (int)pair5.Key;
                this.AddActionsFromSkill(actions, skillID);
                continue;
            }

            case AssetRefType.SkillCombine:
            {
                KeyValuePair <object, AssetRefType> pair4 = enumerator.Current;
                int skillCombineID = (int)pair4.Key;
                this.AddActionsFromSkillCombine(actions, skillCombineID);
                continue;
            }

            case AssetRefType.Prefab:
            case AssetRefType.Particle:
            {
                KeyValuePair <object, AssetRefType> pair3 = enumerator.Current;
                string str2 = pair3.Key as string;
                if (!this.prefabDict.ContainsKey(str2))
                {
                    this.prefabDict.Add(str2, type == AssetRefType.Particle);
                }
                continue;
            }

            case AssetRefType.MonsterConfigId:
            {
                KeyValuePair <object, AssetRefType> pair6 = enumerator.Current;
                int num3 = (int)pair6.Key;
                this.AddActionsFromSoldier(actions, (uint)num3);
                continue;
            }
            }
        }
    }
Ejemplo n.º 15
0
    private void AddAction(DictionaryView <string, AGE.Action> actions, byte[] actionNameUtf8)
    {
        string key = StringHelper.UTF8BytesToString(ref actionNameUtf8);

        if (((key != null) && !this.actionDict.ContainsKey(key)) && !actions.ContainsKey(key))
        {
            actions.Add(key, null);
        }
    }
Ejemplo n.º 16
0
 public static BehaviorNode CreateBehaviorNode(string className)
 {
     if (ms_behaviorNodeTypes.ContainsKey(className))
     {
         System.Type type = ms_behaviorNodeTypes[className];
         return(Activator.CreateInstance(type) as BehaviorNode);
     }
     return(null);
 }
Ejemplo n.º 17
0
    private void AddAction(DictionaryView <string, Action> actions, byte[] actionNameUtf8)
    {
        string text = StringHelper.UTF8BytesToString(ref actionNameUtf8);

        if (text != null && !this.actionDict.ContainsKey(text) && !actions.ContainsKey(text))
        {
            actions.Add(text, null);
        }
    }
Ejemplo n.º 18
0
        private static object FromStringStruct(System.Type type, string src)
        {
            object obj2 = Activator.CreateInstance(type);
            DictionaryView <string, FieldInfo> view = new DictionaryView <string, FieldInfo>();

            foreach (FieldInfo info in type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                if (!info.IsLiteral)
                {
                    view.Add(info.Name, info);
                }
            }
            if (!string.IsNullOrEmpty(src))
            {
                int num2       = SkipPairedBrackets(src, 0);
                int startIndex = 1;
                int index      = src.IndexOf(';', startIndex);
                while (index != -1)
                {
                    if (index > startIndex)
                    {
                        string str2;
                        int    num5   = src.IndexOf('=', startIndex);
                        int    length = num5 - startIndex;
                        string key    = src.Substring(startIndex, length);
                        char   ch     = src[num5 + 1];
                        if (ch != '{')
                        {
                            length = (index - num5) - 1;
                            str2   = src.Substring(num5 + 1, length);
                        }
                        else
                        {
                            int indexBracketBegin = 0;
                            indexBracketBegin += num5 + 1;
                            length             = (SkipPairedBrackets(src, indexBracketBegin) - indexBracketBegin) + 1;
                            str2  = src.Substring(num5 + 1, length);
                            index = (num5 + 1) + length;
                        }
                        if (view.ContainsKey(key))
                        {
                            FieldInfo info2 = view[key];
                            object    obj3  = FromString(info2.FieldType, str2, false);
                            info2.SetValue(obj2, obj3);
                        }
                    }
                    startIndex = index + 1;
                    index      = src.IndexOf(';', startIndex);
                    if (index > num2)
                    {
                        return(obj2);
                    }
                }
            }
            return(obj2);
        }
Ejemplo n.º 19
0
 protected virtual void Update()
 {
     if (_hasRenderer)
     {
         _hasRenderer = false;
         if (_toClean.Count > 0)
         {
             for (int j = 0; j < _toClean.Count; j++)
             {
                 Mesh mesh = _toClean[j];
                 if (mesh != null)
                 {
                     if (Application.isEditor)
                     {
                         UnityEngine.Object.DestroyImmediate(mesh, true);
                     }
                     else
                     {
                         UnityEngine.Object.Destroy(mesh);
                     }
                 }
             }
         }
         _toClean.Clear();
     }
     if (!_matToTrailList.ContainsKey(this.TrailData.TrailMaterial))
     {
         _matToTrailList.Add(this.TrailData.TrailMaterial, new ListView <PCTrail>());
     }
     if (this._activeTrail != null)
     {
         this.UpdatePoints(this._activeTrail, Time.deltaTime);
         this.UpdateTrail(this._activeTrail, Time.deltaTime);
         this.GenerateMesh(this._activeTrail);
         _matToTrailList[this.TrailData.TrailMaterial].Add(this._activeTrail);
     }
     for (int i = this._fadingTrails.Count - 1; i >= 0; i--)
     {
         if ((this._fadingTrails[i] == null) || !this.AnyElement(this._fadingTrails[i].Points))
         {
             if (this._fadingTrails[i] != null)
             {
                 this._fadingTrails[i].Dispose();
             }
             this._fadingTrails.RemoveAt(i);
         }
         else
         {
             this.UpdatePoints(this._fadingTrails[i], Time.deltaTime);
             this.UpdateTrail(this._fadingTrails[i], Time.deltaTime);
             this.GenerateMesh(this._fadingTrails[i]);
             _matToTrailList[this.TrailData.TrailMaterial].Add(this._fadingTrails[i]);
         }
     }
     this.CheckEmitChange();
 }
Ejemplo n.º 20
0
        protected override void OnClose()
        {
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat.ContainsKey((uint)this.SubjCamp))
            {
                CampInfo campInfo = campStat[(uint)this.SubjCamp];
                campInfo.onCampScoreChanged -= new CampInfo.CampInfoValueChanged(this.ValidateKill);
            }
        }
Ejemplo n.º 21
0
        protected override void OnStart()
        {
            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);
                base.Current = campInfo.campScore;
            }
        }
Ejemplo n.º 22
0
 public CNamedEvent FindEventStatic(string eventName, string className)
 {
     if (this.ms_eventInfosGlobal.ContainsKey(className))
     {
         DictionaryView <CStringID, CNamedEvent> dictionaryView = this.ms_eventInfosGlobal[className];
         CStringID key = new CStringID(eventName);
         if (dictionaryView.ContainsKey(key))
         {
             return(dictionaryView[key]);
         }
     }
     return(null);
 }
Ejemplo n.º 23
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);
 }
Ejemplo n.º 24
0
 public int CalcDamageAddition(uint attackerMark, uint suffererMark)
 {
     if ((this._dataDict != null) && this._dataDict.ContainsKey(attackerMark))
     {
         DictionaryView <uint, ResClashAddition> view = this._dataDict[attackerMark];
         if (view.ContainsKey(suffererMark))
         {
             ResClashAddition addition = view[suffererMark];
             return(Singleton <BattleLogic> .GetInstance().dynamicProperty.GetDynamicDamage(addition.dwDynamicConfig, (int)addition.dwDamageAddition));
         }
     }
     return(0x2710);
 }
Ejemplo n.º 25
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);
 }
Ejemplo n.º 26
0
        public static ListView <UrlAction> ParseFromText(string text, char[] spliter = null)
        {
            ListView <UrlAction> view = new ListView <UrlAction>();

            if (spliter == null)
            {
                spliter = MultiSpliter;
            }
            try
            {
                string[] strArray = text.Split(spliter, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < strArray.Length; i++)
                {
                    string[] strArray2 = strArray[i].Split(InnerSpliter, StringSplitOptions.RemoveEmptyEntries);
                    if (strArray2.Length > 0)
                    {
                        DictionaryView <string, string> view2 = new DictionaryView <string, string>();
                        for (int j = 1; j < strArray2.Length; j++)
                        {
                            string[] strArray3 = strArray2[j].Split(ParamSpliter);
                            if ((strArray3 != null) && (strArray3.Length == 2))
                            {
                                view2.Add(strArray3[0], strArray3[1]);
                            }
                        }
                        UrlAction item = new UrlAction {
                            target = strArray2[0],
                            action = Action.none
                        };
                        if (view2.ContainsKey("action"))
                        {
                            string key = view2["action"];
                            if (key != null)
                            {
                                int num3;
                                if (< > f__switch$map2 == null)
                                {
                                    Dictionary <string, int> dictionary = new Dictionary <string, int>(3);
                                    dictionary.Add("openUrl", 0);
                                    dictionary.Add("openForm", 1);
                                    dictionary.Add("buy", 2);
                                    < > f__switch$map2 = dictionary;
                                }
Ejemplo n.º 27
0
 public static void InitHeroSkinDicData()
 {
     s_heroSkinDic.Clear();
     Dictionary <long, object> .Enumerator enumerator = GameDataMgr.heroSkinDatabin.GetEnumerator();
     while (enumerator.MoveNext())
     {
         KeyValuePair <long, object> current = enumerator.Current;
         ResHeroSkin item = current.Value as ResHeroSkin;
         if (((item != null) && (item.bIsShow != 0)) && (GameDataMgr.heroDatabin.GetDataByKey(item.dwHeroID) != null))
         {
             if (!s_heroSkinDic.ContainsKey(item.dwHeroID))
             {
                 ListView <ResHeroSkin> view = new ListView <ResHeroSkin>();
                 s_heroSkinDic.Add(item.dwHeroID, view);
             }
             s_heroSkinDic[item.dwHeroID].Add(item);
         }
     }
 }
Ejemplo n.º 28
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["action"];
                            string text3 = text2;
                            string text4 = text3;
                            if (text4 != null)
                            {
                                if (UrlAction.< > f__switch$map2 == null)
                                {
                                    Dictionary <string, int> dictionary = new Dictionary <string, int>(4);
                                    dictionary.Add("openUrl", 0);
                                    dictionary.Add("openForm", 1);
                                    dictionary.Add("buy", 2);
                                    dictionary.Add("openMatchUrl", 3);
                                    UrlAction.< > f__switch$map2 = dictionary;
                                }
                                int num;
                                if (UrlAction.< > f__switch$map2.TryGetValue(text4, ref num))
                                {
                                    switch (num)
                                    {
                                    case 0:
                                        urlAction.action = UrlAction.Action.openUrl;
                                        urlAction.url    = dictionaryView["url"];
                                        break;

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

                                    case 2:
                                        urlAction.action   = UrlAction.Action.buy;
                                        urlAction.prodType = (COM_ITEM_TYPE)int.Parse(dictionaryView["prodType"]);
                                        urlAction.prodID   = uint.Parse(dictionaryView["prodID"]);
                                        if (dictionaryView.ContainsKey("prodSpec"))
                                        {
                                            int.TryParse(dictionaryView["prodSpec"], ref urlAction.prodSpec);
                                        }
                                        break;

                                    case 3:
                                    {
                                        int num2 = text.IndexOf("#action=openMatchUrl");
                                        if (num2 > 0)
                                        {
                                            urlAction.target = text.Substring(0, num2);
                                        }
                                        urlAction.action = UrlAction.Action.openMatchUrl;
                                        break;
                                    }
                                    }
                                }
                            }
                        }
                        if (dictionaryView.ContainsKey("overTime"))
                        {
                            ulong.TryParse(dictionaryView["overTime"], ref urlAction.overTime);
                        }
                        if (dictionaryView.ContainsKey("showTime"))
                        {
                            int.TryParse(dictionaryView["showTime"], ref urlAction.showTime);
                        }
                        listView.Add(urlAction);
                    }
                }
            }
            catch (Exception var_11_299)
            {
            }
            return(listView);
        }
Ejemplo n.º 29
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 key  = 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(key))
                    {
                        FieldInfo fieldInfo2 = dictionaryView[key];
                        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);
        }
Ejemplo n.º 30
0
    private void AddReferencedAssets(DictionaryView <string, Action> actions, Dictionary <object, AssetRefType> actionAssets)
    {
        Dictionary <object, AssetRefType> .Enumerator enumerator = actionAssets.GetEnumerator();
        while (enumerator.MoveNext())
        {
            KeyValuePair <object, AssetRefType> current = enumerator.get_Current();
            AssetRefType value = current.get_Value();
            switch (value)
            {
            case AssetRefType.Action:
            {
                KeyValuePair <object, AssetRefType> current2 = enumerator.get_Current();
                string key = current2.get_Key() as string;
                if (!this.actionDict.ContainsKey(key) && !actions.ContainsKey(key))
                {
                    actions.Add(key, null);
                }
                break;
            }

            case AssetRefType.SkillID:
            {
                KeyValuePair <object, AssetRefType> current3 = enumerator.get_Current();
                ulong num     = (ulong)current3.get_Key();
                int   skillID = (int)(num & (ulong)-1);
                this.AddActionsFromSkill(actions, skillID);
                break;
            }

            case AssetRefType.SkillCombine:
            {
                KeyValuePair <object, AssetRefType> current4 = enumerator.get_Current();
                ulong num2           = (ulong)current4.get_Key();
                int   skillCombineID = (int)(num2 & (ulong)-1);
                this.AddActionsFromSkillCombine(actions, skillCombineID);
                break;
            }

            case AssetRefType.Prefab:
            case AssetRefType.Particle:
            {
                KeyValuePair <object, AssetRefType> current5 = enumerator.get_Current();
                string text = current5.get_Key() as string;
                if (!this.prefabDict.ContainsKey(text))
                {
                    this.prefabDict.Add(text, value == AssetRefType.Particle);
                }
                break;
            }

            case AssetRefType.MonsterConfigId:
            {
                KeyValuePair <object, AssetRefType> current6 = enumerator.get_Current();
                ulong num3      = (ulong)current6.get_Key();
                uint  soldierID = (uint)(num3 & (ulong)-1);
                this.AddActionsFromSoldier(actions, soldierID);
                break;
            }
            }
        }
    }