示例#1
0
 static private void TimerShow(int totalSeconds)
 {
     TimerHeap.AddTimer <int>(1000, 0,
                              (sec) =>
     {
         if (sec > 0)
         {
             sec--;
             MainUIViewManager.Instance.SetSelfAttackText(sec.ToString(), false);
             TimerShow(sec);
         }
         else
         {
             //MogoWorld.arenaState = 1;
             ClientEventData.TriggerGearEvent(181);
             MainUIViewManager.Instance.ShowNormalAttackButton(true);
             MainUIViewManager.Instance.ShowSkillButton(true, 0);
             MainUIViewManager.Instance.ShowSkillButton(true, 1);
             MainUIViewManager.Instance.ShowSkillButton(true, 2);
             MainUILogicManager.Instance.ShowSpriteSkillButton();
             MainUIViewManager.Instance.SetSelfAttackText(String.Empty, false);
         }
     },
                              totalSeconds);
 }
示例#2
0
        public void TestDefaultSerialization()
        {
            var original = new ClientEventData();
            var serialized = JsonSerialization.Minimal.Serialize(original);
            var deseralized = JsonSerialization.Minimal.Deserialize<ClientEventData>(serialized);

            Assert.IsNull(deseralized.Exceptions);
            Assert.IsNull(deseralized.Packets);
            Assert.IsNull(deseralized.Actions);
        }
示例#3
0
    void OnTriggerEnter()
    {
        if (m_entered)
        {
            m_entered = false;
            ClientEventData.TriggerGearEvent(20002);

            MainUIViewManager.Instance.ShowBossTarget(false);
            TimerHeap.AddTimer(1000, 0, () => { SubAssetCacheMgr.ReleaseCharacterResources(); EventDispatcher.TriggerEvent(Events.TowerEvent.EnterMap); });
        }
    }
示例#4
0
        public void TestSingleDepthPopulationSerialization()
        {
            var original = new ClientEventData() {
                Actions = new List<INetworkAction>() {
                    new NetworkAction() {
                        Uid = Guid.Empty
                    }
                },
                Exceptions = new List<String>() {
                    ""
                },
                Packets = new List<IPacket>() {
                    new Packet() {
                        Stamp = new DateTime(2000, 10, 10, 10, 10, 10)
                    }
                }
            };
            var serialized = JsonSerialization.Minimal.Serialize(original);
            var deseralized = JsonSerialization.Minimal.Deserialize<ClientEventData>(serialized);

            Assert.IsNotEmpty(deseralized.Exceptions);
            Assert.IsNotEmpty(deseralized.Packets);
            Assert.IsNotEmpty(deseralized.Actions);
        }
示例#5
0
 private void OnOpenClientView(ClientEventData clientEventData)
 {
     Load(clientEventData.ClientId);
 }
示例#6
0
    /// <summary>
    /// 私有的函数执行过程
    /// </summary>
    /// <param name="commands"></param>
    private void executeCommand(string[] commands)
    {
        LoggerHelper.Warning("executeCommand :" + commands.PackArray());
        switch (commands[0])
        {
        case "CreateModel":
        {
            var     list1 = commands[5].Split(new char[] { ',' });
            Vector3 vec   = new Vector3(float.Parse(list1[0]), float.Parse(list1[1]), float.Parse(list1[2]));
            if (commands.Length > 6 && commands[6].Equals("false"))
            {
                CreateModel(Int32.Parse(commands[1]), Int32.Parse(commands[2]), Int32.Parse(commands[3]), Int32.Parse(commands[4]), vec, false);
            }
            else
            {
                CreateModel(Int32.Parse(commands[1]), Int32.Parse(commands[2]), Int32.Parse(commands[3]), Int32.Parse(commands[4]), vec);
            }

            break;
        }

        case "DestroyModel":
        {
            int id = Int32.Parse(commands[1]);
            AssetCacheMgr.ReleaseInstance(m_entityList[id].GameObject);
            BillboardLogicManager.Instance.RemoveBillboard(m_entityList[Int32.Parse(commands[1])].ID);
            EventDispatcher.RemoveEventListener <GameObject, Vector3>(MogoMotor.ON_MOVE_TO, m_entityList[Int32.Parse(commands[1])].OnMoveTo);
            m_entityList.Remove(id);
            break;
        }

        case "PlayAction":
        {
            int id = Int32.Parse(commands[1]);
            PlayAction(id, Int32.Parse(commands[2]));
            break;
        }

        case "PlayOneAction":
        {
            int id = Int32.Parse(commands[1]);
            PlayAction(id, Int32.Parse(commands[2]));
            m_entityList[id].AddCallbackInFrames <EntityParent>((ent) => { ent.SetAction(0); }, m_entityList[id]);
            break;
        }

        case "StopAction":
        {
            int id = Int32.Parse(commands[1]);
            m_entityList[id].AddCallbackInFrames <EntityParent>((ent) => { ent.SetAction(0); }, m_entityList[id]);
            break;
        }

        case "PlaySfx":
        {
            if (commands.Length > 3)
            {
                var     list1 = commands[4].Split(new char[] { ',' });
                Vector3 vec   = new Vector3(float.Parse(list1[0]), float.Parse(list1[1]), float.Parse(list1[2]));
                PlaySfx(Int32.Parse(commands[1]), Int32.Parse(commands[2]), Int32.Parse(commands[3]), vec);
            }
            else
            {
                PlaySfx(Int32.Parse(commands[1]), Int32.Parse(commands[2]));
            }

            break;
        }

        case "StopSfx":
            if (commands.Length > 2)
            {
                StopSfx(Int32.Parse(commands[1]), Int32.Parse(commands[2]));
            }
            else
            {
                StopSfx(Int32.Parse(commands[1]));
            }
            break;

        case "MoveCamera":
            if (commands.Length == 5)
            {
                var list1 = commands[2].Split(new char[] { ',' });
                var list2 = commands[3].Split(new char[] { ',' });
                MoveCamera(Int32.Parse(commands[1]), float.Parse(list1[0]), float.Parse(list2[0]), float.Parse(list1[1]), float.Parse(list2[1]),
                           float.Parse(list1[2]), float.Parse(list2[2]), float.Parse(list1[3]), float.Parse(list2[3]), float.Parse(commands[4]));
            }
            else if (commands.Length == 6)
            {
                var     list1 = commands[2].Split(new char[] { ',' });
                var     list2 = commands[3].Split(new char[] { ',' });
                var     list3 = commands[5].Split(new char[] { ',' });
                Vector3 vec   = new Vector3(float.Parse(list3[0]), float.Parse(list3[1]), float.Parse(list3[2]));
                MoveCamera(Int32.Parse(commands[1]), float.Parse(list1[0]), float.Parse(list2[0]), float.Parse(list1[1]), float.Parse(list2[1]),
                           float.Parse(list1[2]), float.Parse(list2[2]), float.Parse(list1[3]), float.Parse(list2[3]), float.Parse(commands[4]), vec);
            }
            else
            {
                MogoMainCamera.Instance.PlayCGAnim(commands[1]);
            }
            break;

        case "SetPosition":
        {
            int id = Int32.Parse(commands[1]);
            if (!m_entityList.ContainsKey(id))
            {
                LoggerHelper.Debug("id not exist in list");
            }
            else
            {
                var list1 = commands[2].Split(new char[] { ',' });
                m_entityList[id].SetPositon(float.Parse(list1[0]), float.Parse(list1[1]), float.Parse(list1[2]));
            }
            break;
        }

        case "SetRotation":
        {
            int id = Int32.Parse(commands[1]);
            if (!m_entityList.ContainsKey(id))
            {
                LoggerHelper.Debug("id not exist in list");
            }
            else
            {
                var list1 = commands[2].Split(new char[] { ',' });
                m_entityList[id].SetRotation(float.Parse(list1[0]), float.Parse(list1[1]), float.Parse(list1[2]));
            }
            break;
        }

        case "ShakeCamera":
            if (commands.Length > 3)
            {
                var list1 = commands[1].Split(new char[] { ',' });
                var vec   = new Vector3(float.Parse(list1[0]), float.Parse(list1[1]), float.Parse(list1[2]));
                var list2 = commands[2].Split(new char[] { ',' });
                ShakeCamera(vec, Int32.Parse(list2[0]), Int32.Parse(list2[1]), Int32.Parse(list2[2]), float.Parse(commands[3]) / 1000);
            }
            else
            {
                ShakeCamera(Int32.Parse(commands[1]), float.Parse(commands[2]) / 1000);
            }
            break;

        case "WhiteCamera":
        {
            var     list1 = commands[1].Split(new char[] { ',' });
            Vector2 vec   = new Vector2(float.Parse(list1[0]), float.Parse(list1[1]));
            MogoMainCamera.Instance.FadeToAllWhite(vec, float.Parse(commands[2]) / 1000);
            break;
        }

        case "NormalCamera":
        {
            var     list1 = commands[1].Split(new char[] { ',' });
            Vector2 vec   = new Vector2(float.Parse(list1[0]), float.Parse(list1[1]));
            MogoMainCamera.Instance.FadeToNoneWhite(vec, float.Parse(commands[2]) / 1000);
            break;
        }

        case "MoveTo":
        {
            int id    = Int32.Parse(commands[1]);
            var list1 = commands[2].Split(new char[] { ',' });
            m_entityList[id].MoveTo(float.Parse(list1[0]), float.Parse(list1[1]), float.Parse(list1[2]));
            break;
        }

        case "ShowDialog":
        {
            var list1 = (from x in commands[1].Split(new char[] { ',' }) select LanguageData.GetContent(Int32.Parse(x)).Replace("{0}", MogoWorld.thePlayer.name)).ToArray();
            var list2 = (from x in commands[2].Replace("{0}", IconData.GetPortraitByVocation(MogoWorld.thePlayer.vocation)).Split(new char[] { ',' }) select IconData.dataMap.Get(Int32.Parse(x)).path).ToArray();
            var list3 = (from x in commands[3].Split(new char[] { ',' }) select FormatTaskText(LanguageData.GetContent(Int32.Parse(x)))).ToArray();
            GuideSystem.Instance.IsGuideDialog = true;
            if (m_currentStoryID != 0)
            {
                //CG
                MogoUIManager.Instance.ShowMogoTaskUI(TaskUILogicManager.Instance.SetTaskInfo, list1, list2, list3, MogoUIManager.Instance.m_MainUI);
            }
            else
            {
                MogoUIManager.Instance.ShowGuideTaskUI(DialogUILogicManager.Instance.SetDialogInfo, list1, list2, list3);
            }
            break;
        }

        case "Subtitle":
        {
            MogoUIManager.Instance.ShowSubtitle(LanguageData.GetContent(Int32.Parse(commands[1])), float.Parse(commands[2]), float.Parse(commands[3]));
            break;
        }

        case "ZoomCamera":
        {
            int id   = Int32.Parse(commands[1]);
            var list = commands[3].Split(new char[] { ',' });
            MogoMainCamera.Instance.CloseToTarget(m_entityList[id].Transform, float.Parse(commands[2]), float.Parse(list[1]), float.Parse(list[0]), float.Parse(commands[4]) / 1000, float.Parse(commands[5]) / 1000);
            break;
        }

        case "LockSight":
        {
            MogoMainCamera.Instance.LockSight();
            break;
        }

        case "SetFocus":
        {
            if (commands.Length > 4)
            {
                TeachUILogicManager.Instance.SetTeachUIFocus(Int32.Parse(commands[1]), LanguageData.GetContent(Int32.Parse(commands[2])), false, Int32.Parse(commands[3]), MogoUIManager.Instance.m_MainUI);
                //TeachUILogicManager.Instance.ShowFingerAnim(true);
            }
            else
            {
                TeachUILogicManager.Instance.SetTeachUIFocus(Int32.Parse(commands[1]), LanguageData.GetContent(Int32.Parse(commands[2])), false, Int32.Parse(commands[3]));
                //TeachUILogicManager.Instance.ShowFingerAnim(true);
            }
            break;
        }

        case "SetItemFocus":
        {
            var itemIDs = commands[1].Split(new char[] { ',' }).Select(x => Int32.Parse(x));
            foreach (var item in itemIDs)
            {
                if (InventoryManager.Instance.GetItemNumById(item) > 0)
                {
                    LoggerHelper.Warning("SetItemFocus" + item);
                    TeachUILogicManager.Instance.SetItemFocus(item, LanguageData.GetContent(Int32.Parse(commands[2])), Int32.Parse(commands[3]));
                    break;
                }
            }
            //TeachUILogicManager.Instance.ShowFingerAnim(true);
            break;
        }

        case "SetNonFocus":
        {
            if (commands.Length > 4)
            {
                TeachUILogicManager.Instance.SetTeachUIFocus(Int32.Parse(commands[1]), LanguageData.GetContent(Int32.Parse(commands[2])), true, Int32.Parse(commands[3]), MogoUIManager.Instance.m_MainUI);
                TeachUILogicManager.Instance.ShowFingerAnim(true);
            }
            else
            {
                TeachUILogicManager.Instance.SetTeachUIFocus(Int32.Parse(commands[1]), LanguageData.GetContent(Int32.Parse(commands[2])), true, Int32.Parse(commands[3]));
                TeachUILogicManager.Instance.ShowFingerAnim(true);
            }

            break;
        }

        case "OpenBillboard":
        {
            MogoUIManager.Instance.ShowBillboardList(true);
            break;
        }

        case "CloseBillboard":
        {
            MogoUIManager.Instance.ShowBillboardList(false);
            break;
        }

        case "OpenUI":
        {
            if (commands.Length == 2)
            {
                var type   = typeof(MainUIViewManager);
                var method = type.GetMethod("Show" + commands[1]);
                method.Invoke(MainUIViewManager.Instance, new object[] { true });
            }
            else if (commands.Length == 3)
            {
                var type   = typeof(MainUIViewManager);
                var method = type.GetMethod("Show" + commands[1]);
                method.Invoke(MainUIViewManager.Instance, new object[] { true, Int32.Parse(commands[2]) });
            }
            else
            {
                MogoUIManager.Instance.ShowUI(true);
            }

            break;
        }

        case "CloseUI":
        {
            if (commands.Length == 2)
            {
                var type   = typeof(MainUIViewManager);
                var method = type.GetMethod("Show" + commands[1]);
                method.Invoke(MainUIViewManager.Instance, new object[] { false });
            }
            else if (commands.Length == 3)
            {
                var type   = typeof(MainUIViewManager);
                var method = type.GetMethod("Show" + commands[1]);
                method.Invoke(MainUIViewManager.Instance, new object[] { false, Int32.Parse(commands[2]) });
            }
            else
            {
                MogoUIManager.Instance.ShowUI(false);
                MogoUIManager.Instance.ShowBillboardList(false);
            }

            break;
        }

        case "AddPointer":
        {
            LoggerHelper.Debug("AddPointerToTarget");
            Vector3 point = new Vector3();
            MogoUtils.GetPointInTerrain(float.Parse(commands[1]), float.Parse(commands[2]), out point);
            MogoFXManager.Instance.AddPointerToTarget(MogoWorld.thePlayer.Transform.gameObject, MogoWorld.thePlayer.ID, point);
            break;
        }

        case "Sleep":
        {
            TimerHeap.AddTimer(UInt32.Parse(commands[1]), 0, () => { EventDispatcher.TriggerEvent <SignalEvents>(Events.CommandEvent.CommandEnd, SignalEvents.Sleep); });
            break;
        }

        case "End":
        {
            //结束CG
            FinishCG();
            break;
        }

        case "UnlockQueue":
        {
            MogoUIQueue.Instance.IsLocking = false;
            MogoUIQueue.Instance.Locked    = false;
            MogoUIQueue.Instance.CheckQueue();
            Debug.Log("Unlocking by StoryManager...................................");
            break;
        }

        case "StartGuideUI":
        {
            Mogo.Util.LoggerHelper.Debug("Start GuideUI @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
            TeachUIViewManager.Instance.PrepareShowTeachUI();
            break;
        }

        case "ResetControlStick":
        {
            if (ControlStick.instance != null)
            {
                MogoWorld.thePlayer.Idle();
                MogoWorld.thePlayer.motor.StopNav();
                ControlStick.instance.Reset();
            }
            else
            {
                MogoWorld.thePlayer.Idle();
                MogoWorld.thePlayer.motor.StopNav();
            }
            break;
        }

        case "Gear":
        {
            ClientEventData.TriggerGearEvent(Int32.Parse(commands[1]));
            break;
        }

        case "RemoveEntities":
        {
            MogoWorld.RemoveEntitiesPos();
            break;
        }

        case "ResetEntities":
        {
            MogoWorld.ResetEntitiesPos();
            break;
        }

        default:
            break;
        }
    }
示例#7
0
    public void TowerResp(byte msgID, LuaTable info)
    {
        LoggerHelper.Warning("TowerResp" + msgID + ":" + info.ToString());
        int err = 0;

        switch (msgID)
        {
        case (byte)MsgType.MSG_GET_TOWER_INFO:
            TowerData towerData;
            if (Utils.ParseLuaTable(info, out towerData))
            {
                ClimbTowerUILogicManager.Instance.Data = towerData;
                if (MogoUIManager.Instance.IsWindowOpen((int)WindowName.Tower))
                {
                    ClimbTowerUILogicManager.Instance.RefreshUI(towerData);
                }
                else
                {
                    ChallengeUILogicManager.Instance.RefreshUI((int)ChallengeGridID.ClimbTower);
                }
            }
            break;

        case (byte)MsgType.MSG_ENTER_TOWER:
            Dictionary <int, int> rst;
            if (Utils.ParseLuaTable(info, out rst))
            {
                err = rst[1];
                BattleMenuUILogicManager.Instance.m_TowerFinishSingle = false;
            }
            break;


        case (byte)MsgType.MSG_TOWER_SWEEP:
        case (byte)MsgType.MSG_TOWER_VIP_SWEEP:
        case (byte)MsgType.MSG_CLEAR_TOWER_SWEEP_CD:
            Dictionary <int, int> rst_sweep;
            if (Utils.ParseLuaTable(info, out rst_sweep))
            {
                err = rst_sweep[1];
            }
            break;

        case (byte)MsgType.MSG_CLIENT_TOWER_SUCCESS:
            int level = Convert.ToInt32(info["1"]) + 1;
            EventDispatcher.TriggerEvent <bool, int>(Events.TowerEvent.CreateDoor, true, level);
            BattleMenuUILogicManager.Instance.FinishSingle();
            break;

        case (byte)MsgType.MSG_CLIENT_REPORT:
        {
            Action act = () =>
            {
                MogoUIManager.Instance.OpenWindow((int)WindowName.Tower,
                                                  () =>
                    {
                        ClimbTowerUILogicManager.Instance.SetTowerGridLayout(
                            () =>
                        {
                            //MogoGlobleUIManager.Instance.ShowWaitingTip(true);
                            ClimbTowerUILogicManager.Instance.ResourceLoaded();
                            ReportData reportData;
                            if (Utils.ParseLuaTable(info, out reportData))
                            {
                                ClimbTowerUILogicManager.Instance.OpenReport(reportData);
                            }
                            EventDispatcher.TriggerEvent(Events.TowerEvent.GetInfo);
                        });
                    });
            };
            if (MogoUIManager.Instance.IsWindowOpen((int)WindowName.Tower))
            {
                ClimbTowerUILogicManager.Instance.SetTowerGridLayout(
                    () =>
                    {
                        //MogoGlobleUIManager.Instance.ShowWaitingTip(true);
                        ClimbTowerUILogicManager.Instance.ResourceLoaded();
                        ReportData reportData;
                        if (Utils.ParseLuaTable(info, out reportData))
                        {
                            ClimbTowerUILogicManager.Instance.OpenReport(reportData);
                        }
                        EventDispatcher.TriggerEvent(Events.TowerEvent.GetInfo);
                    });
            }
            else
            {
                MogoUIQueue.Instance.PushOne(act, MogoUIManager.Instance.m_NormalMainUI, "CLIENT_REPORT");
            }
        }
        break;

        case (byte)MsgType.MSG_TOWER_NOTIFY_COUNT_DOWN:
        {
            TowerInfo towerInfo;
            if (Utils.ParseLuaTable(info, out towerInfo))
            {
                var cd     = towerInfo.cd;
                int hour   = (int)cd / 3600;
                int minute = (int)cd % 3600 / 60;
                int sec    = (int)cd % 60;
                MainUIViewManager.Instance.BeginCountDown1(true, MogoCountDownTarget.ClimbTower, hour, minute, sec);
                MainUIViewManager.Instance.SetClimbTowerCurrentNum(towerInfo.level);
                MogoWorld.thePlayer.CurMissionID    = (int)InstanceIdentity.TOWER;
                MogoWorld.thePlayer.CurMissionLevel = towerInfo.level;
                MainUIViewManager.Instance.ShowClimbTowerCurrentInfo(true);
                MainUIViewManager.Instance.ResetPlayerBloodAnim();
            }
        }
        break;

        case (byte)MsgType.MSG_TOWER_START_DESTROY:
        {
            ClientEventData.TriggerGearEvent(180);
            break;
        }

        default:
            break;
        }
        if (err > 0)
        {
            MogoMsgBox.Instance.ShowFloatingText(LanguageData.dataMap.Get(823 + err).content);
        }
    }
示例#8
0
 private void AttackTriggerGearEvent(int eventID)
 {
     ClientEventData.TriggerGearEvent(eventID);
 }