Exemplo n.º 1
0
        }         // func time

        /// <summary>Converts a time to a .net DateTime</summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public static DateTime datetime(object time)
        {
            if (time is LuaTable)
            {
                LuaTable table = (LuaTable)time;
                return(new DateTime(
                           table.ContainsKey("year") ? (int)table["year"] < 1970 ? 1970 : (int)table["year"] : 1970,
                           table.ContainsKey("month") ? (int)table["month"] : 1,
                           table.ContainsKey("day") ? (int)table["day"] : 1,
                           table.ContainsKey("hour") ? (int)table["hour"] : 0,
                           table.ContainsKey("min") ? (int)table["min"] : 0,
                           table.ContainsKey("sec") ? (int)table["sec"] : 0,
                           table.ContainsKey("isdst") ? (table.ContainsKey("isdst") == true) ? DateTimeKind.Local : DateTimeKind.Utc : DateTimeKind.Local
                           ));
            }
            else if (time is int)
            {
                return(dtUnixStartTime.AddSeconds((int)time));
            }
            else if (time is double)
            {
                return(dtUnixStartTime.AddSeconds((double)time));
            }
            else
            {
                throw new ArgumentException();
            }
        }         // func datetime
    public void FillJewelFXGridList(LuaTable FXData = null)
    {
        if (FXData == null)
        {
            return;
        }

        System.Collections.Generic.List <EquipFXUIGridData> listData = new System.Collections.Generic.List <EquipFXUIGridData>();
        var data = EquipSpecialEffectData.dataMap.OrderBy(x => x.Key);

        foreach (var item in data)
        {
            if (item.Value.group == 1)
            {
                int currentMark            = CalculateJewelMarks(item.Value.level);
                int totalMark              = item.Value.activeScore;
                EquipFXUIGridData gridData = new EquipFXUIGridData();
                gridData.gridIcon = "";//ItemParentData.GetItem(item.Value.icon).Icon;
                if (FXData.ContainsKey(item.Key.ToString()))
                {
                    gridData.isActive = true;
                }
                else
                {
                    gridData.isActive = false;
                }
                gridData.gridProgressText = string.Concat(currentMark, " / ", totalMark);
                gridData.gridProgressSize = (float)currentMark / (float)totalMark;
                gridData.gridText         = LanguageData.GetContent(item.Value.activeDesp);
                listData.Add(gridData);
            }
        }

        RefreshFXGrid(listData);
    }
        protected virtual bool Contains(LuaTable table, IPathNode node)
        {
            var indexedNode = node as IndexedNode;

            if (indexedNode != null)
            {
                return(table.ContainsKey(indexedNode.Value));
            }

            var memberNode = node as MemberNode;

            if (memberNode != null)
            {
                return(table.ContainsKey(memberNode.Name));
            }

            return(false);
        }
Exemplo n.º 4
0
    private void Parse(string atlasName, LuaTable animationCfg)
    {
        List <Sprite> spriteList = ResourceManager.Instance.LoadSpriteAtlas(atlasName);
        Dictionary <string, SpriteAnimationClip> clipMap = new Dictionary <string, SpriteAnimationClip>();

        for (int i = 0; i < spriteList.Count; i++)
        {
            if (spriteList[i] == null)
            {
                continue;
            }

            string[]            names    = spriteList[i].name.Split('_');
            string              action   = names[0];
            string              dir      = names[1];
            string              index    = names[2];
            string              clipName = GetClipName(action, dir);
            SpriteAnimationClip clip     = null;
            if (!clipMap.TryGetValue(clipName, out clip))
            {
                clip = new SpriteAnimationClip();
                clipMap[clipName] = clip;
                clip.Name         = clipName;
                if (animationCfg != null && animationCfg.ContainsKey <string>(action))
                {
                    clip.Length = animationCfg.GetInPath <float>(string.Format("{0}.clip_length", action));
                    if (animationCfg.GetInPath <string>(string.Format("{0}.loop", action)) == "once")
                    {
                        clip.WrapMode = SpriteAnimation.AnimationWrapMode.eOnce;
                    }
                    else
                    {
                        clip.WrapMode = SpriteAnimation.AnimationWrapMode.eLoop;
                    }
                }
                else
                {
                    Debuger.LogError("common", "ArmySpriteAnimation parse animationCfg have problem!");
                    clip.Length   = 1;
                    clip.WrapMode = SpriteAnimation.AnimationWrapMode.eLoop;
                }
                clip.SpriteList = new List <Sprite>();
            }

            clip.SpriteList.Add(spriteList[i]);
        }

        List <SpriteAnimationClip> clipList = new List <SpriteAnimationClip>();

        foreach (var item in clipMap)
        {
            clipList.Add(item.Value);
        }

        Animation = gameObject.AddComponent <SpriteAnimation>();
        Animation.Init(clipList);
    }
        /// <summary>
        /// Allows the user to access members/tables that were defined in lua but have no registered C# class for auto-deserialization.
        /// </summary>
        /// <param name="key">Key to the table - e.g. a name of a global variable.</param>
        /// <returns>The 'raw' lua table representation of the desired member. Null if none found under this key.</returns>
        public LuaTable GetKeyRawTable(string key)
        {
            if (_tableCache?.ContainsKey(key) ?? false)
            {
                var test = _tableCache[key];
                var cast = test as LuaTable;
                return(cast);
            }

            return(null);
        }
Exemplo n.º 6
0
 public T GetCustomFunc <T>(string funcName)
 {
     if (_table.ContainsKey(funcName))
     {
         T action;
         _table.Get(funcName, out action);
         return(action);
     }
     else
     {
         return(default(T));
     }
 }
Exemplo n.º 7
0
        private static void PrintTable(LuaTable tbl, string indent, LuaValue _key = null)
        {
            /* sample output:
             *      table: 002CCBA8
             *      {
             *          field = value
             *          X = 10
             *          y = function: 002CCBA8
             *      }
             */
            string i = indent;

            A8Console.Write(i);
            if (_key != null)
            {
                A8Console.Write(_key.ToString() + " = ");
            }
            A8Console.WriteLine(tbl.ToString() + "\n" + i + "{");

            foreach (LuaValue key in tbl.Keys)
            {
                LuaValue v = tbl.GetValue(key);
                if (v.GetTypeCode() == "table")
                {
                    // check that its not a reference of itself
                    if (!scanned.ContainsKey(key))
                    {
                        scanned.SetKeyValue(key, v);
                        PrintTable(v as LuaTable, i + " ", key);
                    }
                    else
                    {
                        A8Console.WriteLine(i + " " + key.ToString() + " = " + v.ToString());
                    }
                }
                else
                {
                    scanned.SetKeyValue(key, v);
                    A8Console.WriteLine(i + " " + key.ToString() + " = " + v.ToString());
                }
            }/*
              * foreach (LuaValue key in tbl.MetaTable.Keys)
              * {
              * A8Console.WriteLine(i + "(MetaTable): " + key.ToString() + " = " + tbl.MetaTable.GetValue(key).ToString());
              * }*/
            A8Console.WriteLine(i + "}");
        }
Exemplo n.º 8
0
    public void call(string funcName, params object[] parameters)
    {
        if (!mFuncs.ContainsKey(funcName))
        {
            if (LuaTable.ContainsKey(funcName) == false)
            {
                GSLogTool.eFormat("GSState.call", "{0} funcName:{1} not eixt", this, funcName);
                return;
            }

            mFuncs[funcName] = LuaTable[funcName] as LuaFunction;;
        }

        ArrayList realParames = new ArrayList(parameters);

        realParames.Insert(0, this.LuaTable);
        mFuncs[funcName].Call(realParames.ToArray());
    }
Exemplo n.º 9
0
 public LuaObject this[LuaObject key]
 {
     get
     {
         if (IsTable)
         {
             LuaTable table = AsTable();
             if (table.ContainsKey(key))
             {
                 return(table[key]);
             }
             else
             {
                 return(LuaEvents.index_event(this, key));
             }
         }
         else
         {
             return(LuaEvents.index_event(this, key));
         }
     }
     set
     {
         if (IsTable)
         {
             var table = AsTable();
             if (table.ContainsKey(key))
             {
                 table[key] = value;
             }
             else
             {
                 LuaEvents.newindex_event(this, key, value);
             }
         }
         else
         {
             LuaEvents.newindex_event(this, key, value);
         }
     }
 }
Exemplo n.º 10
0
        public ITargetProxy CreateProxy(object target, BindingDescription description)
        {
            if (target == null || !(target is ILuaExtendable))
            {
                return(null);
            }

            LuaTable metatable = (target as ILuaExtendable).GetMetatable();

            if (metatable == null || !metatable.ContainsKey(description.TargetName))
            {
                return(null);
            }

            var obj = metatable.Get <object>(description.TargetName);

            if (obj != null)
            {
                LuaFunction function = obj as LuaFunction;
                if (function != null)
                {
                    return(new LuaMethodTargetProxy(target, function));
                }

                IObservableProperty observableValue = obj as IObservableProperty;
                if (observableValue != null)
                {
                    return(new ObservableTargetProxy(target, observableValue));
                }

                IInteractionAction interactionAction = obj as IInteractionAction;
                if (interactionAction != null)
                {
                    return(new InteractionTargetProxy(target, interactionAction));
                }
            }
            return(new LuaTableTargetProxy(target, description.TargetName));
        }
Exemplo n.º 11
0
        public ITargetProxy CreateProxy(object target, BindingDescription description)
        {
            if (target == null || !(target is ILuaExtendable))
            {
                return(null);
            }

            LuaTable metatable = (target as ILuaExtendable).GetMetatable();

            if (metatable == null || !metatable.ContainsKey(description.TargetName))
            {
                return(null);
            }

            LuaFunction function = metatable.Get <LuaFunction>(description.TargetName);

            if (function == null)
            {
                return(null);
            }

            return(new LuaMethodTargetProxy(target, function));
        }
Exemplo n.º 12
0
    protected void HandleResp(CampaignReq handleCode, LuaTable luaTable, ushort auxiliaryArgument = 0)
    {
        switch (handleCode)
        {
            case CampaignReq.CAMPAIGN_NOTIFY_CLIENT_TO_START:
                int startID = ConvertToInt32(luaTable["1"]);
                CampaignActivityStart(startID);
                break;

            case CampaignReq.CAMPAIGN_NOTIFY_CLIENT_TO_FINISH:
                int finishID = ConvertToInt32(luaTable["1"]);
                CampaignActivityFinish(finishID);
                break;

            case CampaignReq.CAMPAIGN_JOIN:
                int matchCountDownTime = ConvertToInt32(luaTable["1"]);
                JoinSuccess(matchCountDownTime);
                break;

            case CampaignReq.CAMPAIGN_MATCH:
                MatchSuccess();
                break;

            case CampaignReq.CAMPAIGN_LEAVE:
                TimerHeap.DelTimer(countDownTimer);
                if (delayShowOgreMustDieTip)
                {
                    CheckDelayShowOgreMustDieTip(theOwner.sceneId, false);
                }
                else
                {
                    MFUIManager.GetSingleton().SwitchUIWithLoad(MFUIManager.MFUIID.CityMainUI);
                    NormalMainUIViewManager.Instance.SetUIDirty();
                }
                break;

            case CampaignReq.CAMPAIGN_COUNT_DOWN:
                TimerHeap.DelTimer(countDownTimer);
                BattleStartCountDown();
                break;

            case CampaignReq.CAMPAIGN_MISSION_COUNT_DOWN:
                int passTime = ConvertToInt32(luaTable["1"]);
                TowerDefenceStartCountDown(passTime);
                break;

            case CampaignReq.CAMPAIGN_RESULT:
                TimerHeap.DelTimer(countDownTimer);
                HandleReward(luaTable, auxiliaryArgument);
                break;

            case CampaignReq.CAMPAIGN_GET_LEFT_TIMES:
                int leftTimes  =0;
                if (luaTable.ContainsKey("1"))
                {
                    leftTimes= ConvertToInt32(luaTable["1"]);
                    SetOgreMustDieLeftTimes(leftTimes);
                }
                break;

            case CampaignReq.CAMPAIGN_GET_ACTIVITY_LEFT_TIME:
                int lastTime = ConvertToInt32(luaTable["1"]);
                OgreMustDieOpen = true;      
                ogreMustDieLastTime = lastTime;
                SetOgreMustDieFinishTimeEscape();
                SetChallengeUIOgreMustDieData();
                break;

            case CampaignReq.CAMPAIGN_NOTIFY_WAVE_COUNT:
                TimerHeap.DelTimer(countDownTimer);
                MainUIViewManager.Instance.SetSelfAttackText(string.Empty, true);
                TimerHeap.DelTimer(messageTimer);
                int waveCount = ConvertToInt32(luaTable["1"]);
                ShowMonsterWave(waveCount);
                break;
        }
    }
        /// <summary></summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        protected override async Task LoadInternAsync(LuaTable arguments)
        {
            async Task CreateNewObjectAsync()
            {
                // load schema
                var documentType = (string)arguments.GetMemberValue("createNew");

                if (documentType == null)
                {
                    throw new ArgumentException("No 'object' or 'createNew' set.");
                }

                // get the object info for the type
                var objectInfo = Shell.ObjectInfos[documentType];

                if (objectInfo.CreateServerSiteOnly || String.IsNullOrEmpty(objectInfo.DocumentUri))
                {
                    throw new ArgumentNullException("object", "Parameter 'object' is missing.");
                }

                // create the new object entry
                obj = await Shell.CreateNewObjectAsync(objectInfo);
            }             // proc CreateNewObject

            // get the object reference for the document
            obj = (PpsObject)arguments.GetMemberValue("Object");

            // new document or load one
            using (var transaction = await Shell.MasterData.CreateTransactionAsync(PpsMasterDataTransactionLevel.Write))
            {
                if (obj == null)                 // no object given
                {
                    await CreateNewObjectAsync();
                }

                data = await obj.GetDataAsync <PpsObjectDataSet>();

                // register events, owner, and in the openDocuments dictionary
                dataAccess = await data.AccessAsync(arguments);

                dataAccess.DisableUI    = new Func <IDisposable>(() => DisableUI("Verarbeite Daten...", -1));
                dataAccess.DataChanged += (sender, e) => OnDataChanged();

                transaction.Commit();
            }

            // get the pane to view, if it is not given
            if (!arguments.ContainsKey("pane"))
            {
                // try to get the uri from the pane list
                var info    = Shell.GetObjectInfo(obj.Typ);
                var paneUri = info["defaultPane"] as string;
                if (!String.IsNullOrEmpty(paneUri))
                {
                    arguments.SetMemberValue("Pane", paneUri);
                }
                else
                {
                    // read the schema meta data
                    paneUri = data.DataSetDefinition.Meta.GetProperty <string>(PpsDataSetMetaData.DefaultPaneUri, null);
                    if (!String.IsNullOrEmpty(paneUri))
                    {
                        arguments.SetMemberValue("Pane", paneUri);
                    }
                }
            }

            // Load mask
            await base.LoadInternAsync(arguments);

            InitializeData();
        }         // proc LoadInternAsync
Exemplo n.º 14
0
        public void MissionResp(byte msg, LuaTable luaTable)
        {
            switch (msg)
            {
                case (byte)MissionReq.ENTER_MISSION:
                    LoggerHelper.Debug("ENTER_MISSION");
                    int enterMissionArg1 = Convert.ToInt32(luaTable["1"]);
                    OnEnterMissionResp(enterMissionArg1);
                    break;

                case (byte)MissionReq.START_MISSION:
                    LoggerHelper.Debug("START_MISSION");
                    OnStartMissionResp();
                    break;

                case (byte)MissionReq.EXIT_MISSION:
                    LoggerHelper.Debug("EXIT_MISSION");
                    OnExitMissionResp();
                    break;

                case (byte)MissionReq.GET_STAR_MISSION:
                    LoggerHelper.Debug("GET_STAR_MISSION");
                    OnUpdateMissionStarsResp(luaTable);
                    break;

                case (byte)MissionReq.RESET_MISSION_TIMES:
                    LoggerHelper.Debug("RESET_MISSION_TIMES");
                    int resetMissionErrorCode = Convert.ToInt32(luaTable["1"]);
                    OnResetMissionTimesResp(resetMissionErrorCode);
                    break;

                case (byte)MissionReq.GET_MISSION_TIMES:
                    LoggerHelper.Debug("GET_MISSION_TIMES");
                    OnUpdateMissionTimesResp(luaTable);
                    break;

                case (byte)MissionReq.GET_FINISHED_MISSIONS:
                    LoggerHelper.Debug("GET_FINISHED_MISSIONS");
                    OnUpdateCharaterFinishedMissionsResp(luaTable);
                    break;

                case (byte)MissionReq.GET_NOTIFY_TO_CLENT_EVENT:
                    LoggerHelper.Debug("GET_NOTIFY_TO_CLENT_EVENT");
                    int eventID = int.Parse(luaTable["1"].ToString());
                    OnNotifyToClientEventResp(eventID);
                    break;

                case (byte)MissionReq.NOTIFY_TO_CLIENT_RESULT:
                    LoggerHelper.Debug("NOTIFY_TO_CLIENT_RESULT");
                    break;

                case (byte)MissionReq.GET_MISSION_LEFT_TIME:
                    LoggerHelper.Debug("GET_MISSION_LEFT_TIME");
                    int getMissionLeftTimeArg1 = (int)luaTable["1"];
                    OnGetMissionLeftTimeResp(getMissionLeftTimeArg1);
                    break;

                case (byte)MissionReq.SPAWNPOINT_START:
                    LoggerHelper.Debug("SPAWNPOINT_START");
                    OnSpawnPointStartResp();
                    break;

                case (byte)MissionReq.SPAWNPOINT_STOP:
                    LoggerHelper.Debug("SPAWNPOINT_STOP");
                    break;

                case (byte)MissionReq.NOTIFY_TO_CLIENT_RESULT_SUCCESS:
                    LoggerHelper.Debug("NOTIFY_TO_CLIENT_RESULT_SUCCESS");

                    if (theOwner.deathFlag != 0)
                    {
                        MogoUIManager.Instance.ShowMogoInstanceRebornUI(false);
                        MogoUIManager.Instance.ShowMogoBattleMainUI();
                        MainUIViewManager.Instance.ResetUIData();
                    }

                    HasWin = true;

                    //停托管
                    //MogoWorld.thePlayer.AutoFight = AutoFightState.IDLE;

                    var id = MissionData.GetCGByMission(MogoWorld.thePlayer.sceneId);
                    if (id > 0)
                    {
                        StoryManager.Instance.SetCallBack(() => { OnNotifyToClientResultSuccessResp(luaTable); });
                        StoryManager.Instance.PlayStory(id);
                    }
                    else
                    {
                        OnNotifyToClientResultSuccessResp(luaTable);
                    }

                    break;

                case (byte)MissionReq.NOTIFY_TO_CLIENT_RESULT_FAILED:
                    LoggerHelper.Debug("NOTIFY_TO_CLIENT_RESULT_FAILED");
                    OnNotifyToClientResultFailedResp();
                    break;

                case (byte)MissionReq.GET_MISSION_REWARDS:
                    LoggerHelper.Debug("GET_MISSION_REWARDS");
                    if (MapData.dataMap.Get(MogoWorld.thePlayer.sceneId).type == MapType.ClimbTower)
                    {
                        return;
                    }
                    OnGetMissionRewardResp(luaTable);
                    break;

                case (byte)MissionReq.CLIENT_MISSION_INFO:
                    LoggerHelper.Debug("CLIENT_MISSION_INFO");
                    string result = (string)luaTable["1"];
                    OnUpdateMissionGearInfo(result);
                    break;

                case (byte)MissionReq.KILL_MONSTER_EXP:
                    LoggerHelper.Debug("KILL_MONSTER_EXP");
                    Dictionary<int, int> data;
                    if (Utils.ParseLuaTable(luaTable, out data))
                    {
                        if (data.ContainsKey(1))
                        {
                            BillboardLogicManager.Instance.AddAloneBattleBillboard(MogoWorld.thePlayer.Transform.position, data[1], AloneBattleBillboardType.Exp);
                        }
                    }
                    break;

                case (byte)MissionReq.QUIT_MISSION:
                    LoggerHelper.Debug("QUIT_MISSION");
                    break;

                case (byte)MissionReq.NOTIFY_TO_CLENT_SPAWNPOINT:
                    LoggerHelper.Debug("NOTIFY_TO_CLENT_SPAWNPOINT");
                    int preID = Convert.ToInt32(luaTable["1"]);
                    EventDispatcher.TriggerEvent(Events.GearEvent.SpawnPointDead, preID);
                    break;

                case (byte)MissionReq.UPLOAD_COMBO:
                    LoggerHelper.Debug("UPLOAD_COMBO");
                    break;

                case (byte)MissionReq.GET_MISSION_TRESURE_REWARDS:
                    LoggerHelper.Debug("GET_MISSION_TRESURE_REWARDS: " + luaTable.ToString());
                    if (Utils.ParseLuaTable(luaTable, out chestData))
                        CheckChestState(chestData);
                    break;

                case (byte)MissionReq.REVIVE:
                    LoggerHelper.Debug("REVIVE");
                    OnAvatarRebornResp(luaTable);
                    break;

                case (byte)MissionReq.GET_REVIVE_TIMES:
                    LoggerHelper.Debug("GET_REVIVE_TIMES");
                    int rebornTimes = Convert.ToInt32(luaTable["1"]);
                    OnGetRebornTimesResp(rebornTimes);
                    break;

                case (byte)MissionReq.MSG_SWEEP_MISSION:
                    LoggerHelper.Debug("MSG_SWEEP_MISSION");
                    int flag = Convert.ToInt32(luaTable["1"]);
                    OnSweepMissionResp(flag);
                    break;

                case (byte)MissionReq.GET_MISSION_SWEEP_LIST:
                    LoggerHelper.Debug("GET_MISSION_SWEEP_LIST");
                    OnGetSweepMissionResp(luaTable);
                    break;

                case (byte)MissionReq.MSG_GET_SWEEP_TIMES:
                    LoggerHelper.Debug("MSG_GET_SWEEP_TIMES");
                    int times = Convert.ToInt32(luaTable["1"]);
                    OnGetSweepTimesResp(times);
                    break;

                case (byte)MissionReq.GET_RESET_TIMES:
                    LoggerHelper.Debug("GET_RESET_TIMES");
                    int totalResetTimes = Convert.ToInt32(luaTable["1"]);
                    OnCheckTotalResetTimesResp(totalResetTimes);
                    break;

                case (byte)MissionReq.GET_RESET_TIMES_BY_MISSION:
                    LoggerHelper.Debug("GET_RESET_TIMES_BY_MISSION");
                    int missionResetTimes = Convert.ToInt32(luaTable["1"]);
                    OnCheckMissionResetTimesResp(MissionCache, LevelCache, missionResetTimes);
                    break;

                case (byte)MissionReq.NOTIFY_TO_CLIENT_TO_UPLOAD_COMBO:
                    LoggerHelper.Debug("NOTIFY_TO_CLIENT_TO_UPLOAD_COMBO");
                    UploadMaxCombo(theOwner.GetMaxCombo());
                    break;

                case (byte)70:
                    OnGetDrops(luaTable);
                    break;

                case (byte)MissionReq.GO_TO_INIT_MAP:
                    break;

                case (byte)MissionReq.GET_MISSION_TRESURE:
                    LoggerHelper.Debug("GET_MISSION_TRESURE: " + luaTable.ToString());
                    int getMissionChestResult = Convert.ToInt32(luaTable["1"]);
                    OnGetChestRewardResp(getMissionChestResult);
                    break;

                case (byte)MissionReq.NOTIFY_TO_CLIENT_MISSION_REWARD:
                    OnBuiltClientMissionRewardPool(luaTable);
                    ServerProxy.SomeToLocal = true;
                    MogoWorld.IsClientPositionSync = false;
                    Mogo.GameLogic.LocalServer.LocalServerSceneManager.Instance.EnterMission(theOwner.CurMissionID, theOwner.CurMissionLevel);
                    int sceneId = MissionData.GetSceneId(theOwner.CurMissionID, theOwner.CurMissionLevel);
                    if (sceneId > -1)
                    {
                        theOwner.sceneId = (ushort)sceneId;
                    }
                    break;

                case (byte)MissionReq.UPLOAD_COMBO_AND_BOTTLE:
                    LoggerHelper.Debug("UPLOAD_COMBO_AND_BOTTLE:" + luaTable.ToString());
                    HandleClientMissionWonData(luaTable);
                    break;

                case (byte)MissionReq.NOTIFY_TO_CLIENT_TO_LOAD_ITNI_MAP:
                    LoggerHelper.Debug("NOTIFY_TO_CLIENT_TO_LOAD_ITNI_MAP:" + luaTable.ToString());
                    ServerProxy.SomeToLocal = false;
                    LocalServerSceneManager.Instance.ExitMission();

                    ushort sceneID = Convert.ToUInt16(luaTable["1"]);
                    ushort imap_id = Convert.ToUInt16(luaTable["2"]);

                    var map = MapData.dataMap.Get(sceneID);
                    theOwner.position = new Vector3(map.enterX * 0.01f, -10000f, map.enterY * 0.01f);
                    theOwner.imap_id = imap_id;
                    theOwner.sceneId = sceneID;
                    break;

                case (byte)MissionReq.GET_MISSION_RECORD:
                    HandleBestRecordMessage(luaTable);
                    break;

                case (byte)MissionReq.NOTIFY_TO_CLIENT_MISSION_INFO:
                    theOwner.CurMissionID = Convert.ToInt32(luaTable["1"]);
                    theOwner.CurMissionLevel = Convert.ToInt32(luaTable["2"]);
                    break;

                case (byte)MissionReq.GET_ACQUIRED_MISSION_BOSS_TREASURE:
                    if (Utils.ParseLuaTable(luaTable, out bossChestData))
                        SetBossChestState(bossChestData);
                    break;

                case (byte)MissionReq.GET_MISSION_BOSS_TREASURE:
                    int bossChestErrorCode = Convert.ToInt32(luaTable["1"]);
                    OnGetBossChestRewardResp(bossChestErrorCode);
                    break;

                case (byte)MissionReq.MWSY_MISSION_NOTIFY_CLIENT:
                    OnNotifyToClientFoggyAbyssOpen();
                    break;

                case (byte)MissionReq.MWSY_MISSION_GET_INFO:
                    bool isShowFoggyAbyss = true;
                    int currentFoggyAbyssLevel = 0;
                    bool hasFoggyAbyssPlay = false;
                    if (!luaTable.ContainsKey("1"))
                    {
                        isShowFoggyAbyss = false;
                    }
                    else
                    {
                        currentFoggyAbyssLevel = Convert.ToInt32(luaTable["1"]);
                        int hasPlayFoggyAbyssCode = Convert.ToInt32(luaTable["2"]);
                        if (hasPlayFoggyAbyssCode > 0)
                            hasFoggyAbyssPlay = true;
                    }
                    OnGetFoggyAbyssInfoResp(isShowFoggyAbyss, currentFoggyAbyssLevel, hasFoggyAbyssPlay);
                    break;

                default:
                    break;
            }
        }
Exemplo n.º 15
0
        public void HandleBestRecordMessage(LuaTable luaTable)
        {
            if (luaTable.ContainsKey("1")
                && luaTable.ContainsKey("2")
                && luaTable.ContainsKey("3"))
            {
                string name = Convert.ToString(luaTable["1"]);
                string score = string.Concat(Convert.ToString(luaTable["2"]), LanguageData.GetContent(7102));

                int vocation = Convert.ToInt32(luaTable["3"]);
                string vocationStr = LanguageData.GetContent(vocation);

                // 复用了时分秒的分
                // InstanceLevelChooseUIViewManager.Instance.SetInstanceLevelChooseUIPlayerNO1(true, name, score, vocationStr);
                InstanceLevelChooseUIViewManager.Instance.SetInstanceLevelChooseUIPlayerNO1(false);
            }
            else
            {
                InstanceLevelChooseUIViewManager.Instance.SetInstanceLevelChooseUIPlayerNO1(false);
            }
        }
Exemplo n.º 16
0
        protected void OnBuiltClientMissionRewardPool(LuaTable luaTable)
        {
            Dictionary<int, int> item = new Dictionary<int, int>();
            int money = 0;
            int exp = 0;

            if (luaTable.ContainsKey("2"))
                money = Convert.ToInt32(luaTable["2"]);

            if (luaTable.ContainsKey("3"))
                exp = Convert.ToInt32(luaTable["3"]);

            if (luaTable.ContainsKey("1"))
                Utils.ParseLuaTable<Dictionary<int, int>>((LuaTable)luaTable["1"], out item);

            Mogo.GameLogic.LocalServer.LocalServerSceneManager.Instance.InitSrvPreCollect(item, money, exp);
        }
Exemplo n.º 17
0
        void OnGetSweepMissionResp(LuaTable luaTable)
        {
            TimerHeap.AddTimer(1000, 0, () =>
            {
                SweepMissionRepostData sweepMissionRepostData = new SweepMissionRepostData();

                // 怪物信息   
                object enemyObj;
                sweepMissionRepostData.Enemys = new Dictionary<int, int>();
                if (Utils.ParseLuaTable((LuaTable)luaTable["1"], typeof(Dictionary<int, int>), out enemyObj))
                {
                    sweepMissionRepostData.Enemys = enemyObj as Dictionary<int, int>;
                    foreach (KeyValuePair<int, int> pair in sweepMissionRepostData.Enemys)
                    {
                        LoggerHelper.Debug("monsterId = " + pair.Key + " , " + "monsterCount = " + pair.Value);
                    }
                }

                // 物品信息
                object itemObj;
                sweepMissionRepostData.Items = new Dictionary<int, int>();
                if (Utils.ParseLuaTable((LuaTable)luaTable["2"], typeof(Dictionary<int, int>), out itemObj))
                {
                    sweepMissionRepostData.Items = itemObj as Dictionary<int, int>;
                    foreach (KeyValuePair<int, int> pair in sweepMissionRepostData.Items)
                    {
                        LoggerHelper.Debug("ItemId = " + pair.Key + " , " + "ItemCount = " + pair.Value);
                    }
                }

                if (luaTable.ContainsKey("3"))
                    sweepMissionRepostData.gold = Convert.ToInt32(luaTable["3"]);
                if (luaTable.ContainsKey("4"))
                    sweepMissionRepostData.exp = Convert.ToInt32(luaTable["4"]);

                InstanceUILogicManager.Instance.OpenMonsterReport(sweepMissionRepostData);
            });
        }
Exemplo n.º 18
0
        public void HandleClientMissionWonData(LuaTable luaTable)
        {
            Dictionary<int, int> items = new Dictionary<int, int>();
            int money = 0;
            int exp = 0;
            int time = 0;
            int starNum = 0;
            int scorePoint = 0;
            int minutes = 0;
            int second = 0;
            cards.Clear();
            itemPool.Clear();

            if (luaTable.ContainsKey("2"))
                money = Convert.ToInt32(luaTable["2"]);

            if (luaTable.ContainsKey("3"))
                exp = Convert.ToInt32(luaTable["3"]);

            if (luaTable.ContainsKey("4"))
            {
                time = Convert.ToInt32(luaTable["4"]);
                minutes = time / 60;
                second = time % 60;
            }

            if (luaTable.ContainsKey("5"))
                starNum = Convert.ToInt32(luaTable["5"]);

            if (luaTable.ContainsKey("6"))
                scorePoint = Convert.ToInt32(luaTable["6"]);

            InstanceUILogicManager.Instance.SetNewPassMessage(minutes, second, MogoWorld.thePlayer.GetMaxCombo(), scorePoint, starNum > 4 ? 4 : starNum);

            theOwner.ResetMaxCombo();

            if (luaTable.ContainsKey("1"))
            {
                if (Utils.ParseLuaTable<Dictionary<int, int>>((LuaTable)luaTable["1"], out items))
                {
                    if (items != null)
                    {
                        List<ItemParent> theItems = new List<ItemParent>();

                        List<int> ids = new List<int>();
                        List<int> counts = new List<int>();

                        foreach (KeyValuePair<int, int> item in items)
                        {
                            var temp = ItemParentData.GetItem(item.Key);
                            if (temp != null)
                            {
                                ids.Add(temp.id);
                                counts.Add(item.Value);
                                LoggerHelper.Debug("mission reward item : ItemID = " + item.Key + ", ItemCount = " + item.Value);
                            }
                        }

                        if (money > 0)
                        {
                            ids.Add(2);
                            counts.Add(money);
                        }

                        if (exp > 0)
                        {
                            ids.Add(1);
                            counts.Add(exp);
                        }
                        // InstanceUILogicManager.Instance.SetInstanceRewardUIReward(ids, counts, itemNames);
                        InstanceUILogicManager.Instance.SetNewInstanceRewardUIReward(ids, counts);
                    }
                }
            }

            if (luaTable.ContainsKey("7"))
            {
                List<Dictionary<int, int>> cardItems;
                Utils.ParseLuaTable<List<Dictionary<int, int>>>((LuaTable)luaTable["7"], out cardItems);
                if (cardItems != null)
                {
                    int counter = 0;
                    foreach (var cardItem in cardItems)
                    {
                        if (counter < starNum - 1)
                        {
                            cards.Add(cardItem);
                            counter++;
                        }
                        itemPool.Add(cardItem);
                    }
                }

                BattlePassCardListUILogicManager.Instance.SetFlipCount(cards.Count);
            }
        }
Exemplo n.º 19
0
        public void OnNotifyToClientResultSuccessResp(LuaTable luaTable)
        {
            LoggerHelper.Debug("Handle Packet");

            if (theOwner.sceneId == 10100)
            {
                #region 进度记录

                GameProcManager.BattleWin(theOwner.CurMissionID, theOwner.CurMissionLevel);

                #endregion

                theOwner.IsNewPlayer = false;
                ForceExitMissionReq();
                return;
            }

            MogoUIManager.Instance.ShowMogoCommuntiyUI(CommunityUIParent.MainUI, false);

            #region 进度记录

            GameProcManager.BattleWin(theOwner.CurMissionID, theOwner.CurMissionLevel);

            #endregion

            #region 音效

            EventDispatcher.TriggerEvent(SettingEvent.ChangeMusic, 60, SoundManager.PlayMusicMode.Single);

            #endregion

            if (luaTable != null && luaTable.Count > 0)
            {
                cards.Clear();
                itemPool.Clear();

                int time = Convert.ToInt32(luaTable["1"]);

                // 能收到说明已经通关
                int starNum = Convert.ToInt32(luaTable["2"]);

                int scorePoint = Convert.ToInt32(luaTable["3"]);

                int minutes = time / 60;
                int second = time % 60;

                if (luaTable.ContainsKey("4"))
                {
                    List<Dictionary<int, int>> cardItems;
                    Utils.ParseLuaTable<List<Dictionary<int, int>>>((LuaTable)luaTable["4"], out cardItems);
                    if (cardItems != null)
                    {
                        int counter = 0;
                        foreach (var cardItem in cardItems)
                        {
                            if (counter < starNum - 1)
                            {
                                cards.Add(cardItem);
                                counter++;
                            }
                            itemPool.Add(cardItem);
                        }
                    }
                    BattlePassCardListUILogicManager.Instance.SetFlipCount(cards.Count);
                }


                //MogoUIManager.Instance.LoadMogoInstanceUI(() =>
                //{
                //    InstanceUIViewManager.Instance.ShowInstancePassUI(true);

                //    InstanceUIViewManager.Instance.SetPassTime(minutes, second);
                //    InstanceUIViewManager.Instance.SetPassMark(starNum > 3 ? 3 : starNum);
                //}, false);

                LoggerHelper.Debug("Handle End");

                MogoUIManager.Instance.LoadMogoInstanceUI(() =>
                {
                    // Debug.LogError("LoadMogoInstanceUI");
                    //InstanceUIViewManager.Instance.ShowInstancePassUI(true);
                    InstancePassRewardUIViewManager.Instance.ShowInstancePassRewardUI(true);
                    InstanceUILogicManager.Instance.SetNewPassMessage(minutes, second, MogoWorld.thePlayer.GetMaxCombo(), scorePoint, starNum > 4 ? 4 : starNum);
                    theOwner.ResetMaxCombo();
                }, false);
            }
            else
            {
                ClientMissionWon();
            }
        }
Exemplo n.º 20
0
    public void HandleReward(LuaTable luaTable, ushort auxiliaryArgument)
    {
        // Debug.LogError("luatable" + luaTable + " \nauxiliaryArgument: " + auxiliaryArgument);

        wave = ConvertToInt32(luaTable["1"]);
        output = ConvertToInt32(luaTable["2"]);
        exp = ConvertToInt32(luaTable["3"]);
        gold = ConvertToInt32(luaTable["4"]);
        rewardItems = new Dictionary<int,int>();
        if (luaTable.ContainsKey("5"))
            Mogo.Util.Utils.ParseLuaTable<Dictionary<int, int>>((LuaTable)luaTable["5"], out rewardItems);

        Dictionary<int, int> result = new Dictionary<int,int>();
        foreach (var item in rewardItems)
            result.Add(item.Key, item.Value);

        if (theOwner.sceneId == MogoWorld.globalSetting.homeScene)
        {
            if ((CampaignResult)auxiliaryArgument == CampaignResult.campaigning)
            {
                ControlStick.instance.Reset();
                MFUIManager.GetSingleton().SwitchUIWithLoad(MFUIManager.MFUIID.BattlePassUINoCard);
                BattlePassUINoCardUILogicManager.Instance.SetIsMVP(false);
                BattlePassUINoCardUILogicManager.Instance.SetTitile(string.Empty);
                BattlePassUINoCardUILogicManager.Instance.SetDefenceNum(wave.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetOutPut(output.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetMVPOutput(string.Empty);
                BattlePassUINoCardUILogicManager.Instance.SetMVPName(string.Empty);
                BattlePassUINoCardUILogicManager.Instance.SetRewardItemList(result);
                BattlePassUINoCardUILogicManager.Instance.PlayAnim(false);
                BattlePassUINoCardUILogicManager.Instance.SetUIDirty();
            }
            else
            {
                Debug.LogError("Are you kidding me? : " + auxiliaryArgument);
            }
        }
        else
        {
            MogoUIManager.Instance.ShowMogoBattleMainUI();

            int mvpOutput = ConvertToInt32(luaTable["6"]);
            string mvpName = Convert.ToString(luaTable["7"]);

            //Dictionary<int, int> mvpRewardItems = new Dictionary<int, int>();
            //if (luaTable.ContainsKey("8"))
            //    Mogo.Util.Utils.ParseLuaTable<Dictionary<int, int>>((LuaTable)luaTable["8"], out mvpRewardItems);

            //foreach (var item in mvpRewardItems)
            //{
            //    if (result.ContainsKey(item.Key))
            //        result[item.Key] += item.Value;
            //    else
            //        result.Add(item.Key, item.Value);
            //}

            if ((CampaignResult)auxiliaryArgument == CampaignResult.win)
            {
                ControlStick.instance.Reset();
                MFUIManager.GetSingleton().SwitchUIWithLoad(MFUIManager.MFUIID.BattlePassUINoCard);
                BattlePassUINoCardUILogicManager.Instance.SetIsMVP(true);
                BattlePassUINoCardUILogicManager.Instance.SetTitile(LanguageData.GetContent(28107));
                BattlePassUINoCardUILogicManager.Instance.SetDefenceNum(wave.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetOutPut(output.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetMVPOutput(mvpOutput.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetMVPName(mvpName);
                BattlePassUINoCardUILogicManager.Instance.SetRewardItemList(result);
                BattlePassUINoCardUILogicManager.Instance.PlayAnim(true);
                BattlePassUINoCardUILogicManager.Instance.SetUIDirty();
            }

            else if ((CampaignResult)auxiliaryArgument == CampaignResult.lose)
            {
                ControlStick.instance.Reset();
                MFUIManager.GetSingleton().SwitchUIWithLoad(MFUIManager.MFUIID.BattlePassUINoCard);
                BattlePassUINoCardUILogicManager.Instance.SetIsMVP(true);
                BattlePassUINoCardUILogicManager.Instance.SetTitile(LanguageData.GetContent(28108));
                BattlePassUINoCardUILogicManager.Instance.SetDefenceNum(wave.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetOutPut(output.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetMVPOutput(mvpOutput.ToString());
                BattlePassUINoCardUILogicManager.Instance.SetMVPName(mvpName);
                BattlePassUINoCardUILogicManager.Instance.SetRewardItemList(result);
                BattlePassUINoCardUILogicManager.Instance.PlayAnim(true);
                BattlePassUINoCardUILogicManager.Instance.SetUIDirty();
            }
            else if ((CampaignResult)auxiliaryArgument == CampaignResult.campaigning)
            {
                showRewardInCity = true;
            }
        }
    }
Exemplo n.º 21
0
    public void FillEquipFXGridList(LuaTable FXData = null)
    {
        if (FXData == null)
            return;

        System.Collections.Generic.List<EquipFXUIGridData> listData = new System.Collections.Generic.List<EquipFXUIGridData>();
        var data = EquipSpecialEffectData.dataMap.OrderBy(x => x.Key);

        foreach (var item in data)
        {
            if (item.Value.group == 2)
            {
                int currentMark = CalculateEquipMarks(item.Value.level);
                int totalMark = item.Value.activeScore;
                EquipFXUIGridData gridData = new EquipFXUIGridData();
                gridData.gridIcon = "";// = ItemParentData.GetItem(item.Value.icon).Icon;

                if (FXData.ContainsKey(item.Key.ToString()))
                {
                    gridData.isActive = true;
                }
                else
                {
                    gridData.isActive = false;
                }
                gridData.gridProgressText = string.Concat(currentMark, " / ", totalMark);
                gridData.gridProgressSize = (float)currentMark / (float)totalMark;
                gridData.gridText = LanguageData.GetContent(item.Value.activeDesp);

                listData.Add(gridData);
            }
        }

        RefreshFXGrid(listData);
    }