Exemple #1
0
    //0丢弃,1丢弃 2援助 3挑衅 4装死 5怒气
    public void OnAction(int id)
    {
        switch (id)
        {
        case 4:
            Main.Ins.LocalPlayer.PlaySkill();
            break;

        case 2:
            Main.Ins.LocalPlayer.ActionMgr.ChangeAction(CommonAction.Reborn);
            break;

        case 3:
            Main.Ins.LocalPlayer.ActionMgr.ChangeAction(CommonAction.Taunt);
            break;

        case 1:
            Main.Ins.LocalPlayer.ActionMgr.ChangeAction(CommonAction.Dead);
            break;

        case 5:
            if (FightState.Exist())
            {
                FightState.Instance.HideSkillBar();
            }
            break;
        }
    }
Exemple #2
0
 void OnEnableDebugSFX(bool on)
 {
     Main.Ins.GameStateMgr.gameStatus.EnableDebugSFX = on;
     if (FightState.Exist())
     {
         FightState.Instance.UpdateUIButton();
     }
 }
Exemple #3
0
 //允许在战斗UI选择武器.
 void OnEnableWeaponChoose(bool on)
 {
     Main.Ins.GameStateMgr.gameStatus.EnableWeaponChoose = on;
     if (FightState.Exist())
     {
         FightState.Instance.UpdateUIButton();
     }
 }
Exemple #4
0
 public override void OnClose()
 {
     if (FightState.Exist())
     {
         FightState.Instance.OnRefresh(0, null);
     }
     if (NGUICameraJoystick.Ins != null)
     {
         NGUICameraJoystick.Ins.enabled = true;
     }
     base.OnClose();
 }
    void OnDisableLock(bool on)
    {
        Main.Ins.GameStateMgr.gameStatus.AutoLock = on;
        if (Main.Ins.CameraFollow != null)
        {
            if (on)
            {
                Main.Ins.CameraFollow.EnableLock();
            }
            else
            {
                Main.Ins.CameraFollow.DisableLock();
            }
        }

        if (Main.Ins.GameBattleEx != null)
        {
            if (on)
            {
                Main.Ins.GameBattleEx.EnableLock();
            }
            else
            {
                Main.Ins.GameBattleEx.Unlock();
                Main.Ins.GameBattleEx.DisableLock();
            }
        }

        if (on)
        {
            if (FightState.Exist())
            {
                FightState.Instance.ShowCameraBtn();
            }
        }
        else
        {
            if (FightState.Exist())
            {
                FightState.Instance.HideCameraBtn();
            }
        }
    }
Exemple #6
0
    void OnFollowEnemy(bool follow)
    {
        if (U3D.WatchAi != follow)
        {
            U3D.WatchAi = follow;
            if (U3D.WatchAi)
            {
                //找到第一个未死亡的角色
                MeteorUnit watchTarget = null;
                for (int i = 0; i < MeteorManager.Ins.UnitInfos.Count; i++)
                {
                    if (MeteorManager.Ins.UnitInfos[i].Dead)
                    {
                        continue;
                    }
                    if (MeteorManager.Ins.UnitInfos[i] == Main.Ins.LocalPlayer)
                    {
                        continue;
                    }
                    watchTarget = MeteorManager.Ins.UnitInfos[i];
                    break;
                }

                Main.Ins.GameBattleEx.InitFreeCamera(watchTarget);
                Main.Ins.GameBattleEx.EnableFollowCamera(false);
                Main.Ins.MainCamera = Main.Ins.CameraFree.m_Camera;
            }
            else
            {
                Main.Ins.GameBattleEx.EnableFollowCamera(true);
                Main.Ins.GameBattleEx.EnableFreeCamera(false);
                Main.Ins.MainCamera = Main.Ins.CameraFollow.m_Camera;
            }

            if (FightState.Exist())
            {
                FightState.Instance.UpdateUIButton();
            }
        }
    }
Exemple #7
0
    public void SetResult(int result)
    {
        if (result == 1)
        {
            for (int i = 0; i < MeteorManager.Ins.UnitInfos.Count; i++)
            {
                if (MeteorManager.Ins.UnitInfos[i].StateMachine != null)
                {
                    MeteorManager.Ins.UnitInfos[i].StateMachine.Stop();
                }
                MeteorManager.Ins.UnitInfos[i].meteorController.Input.ResetVector();
                MeteorManager.Ins.UnitInfos[i].OnGameResult(result);
            }
        }

        if (CombatData.Ins.GGameMode == GameMode.MENGZHU)
        {
            U3D.InsertSystemMsg("回合结束");
        }
        else
        {
            string mat = "";
            Text   txt;
            switch (result)
            {
            case -1:
            case 0:
                mat = "BattleLose";
                txt = Control("ButterflyWin").GetComponent <Text>();
                U3D.InsertSystemMsg("蝴蝶阵营 获胜");
                txt.text = "1";
                break;

            case 1:
            case 2:
                mat = "BattleWin";
                txt = Control("MeteorWin").GetComponent <Text>();
                U3D.InsertSystemMsg("流星阵营 获胜");
                txt.text = "1";
                break;

            case 3:
                mat = "BattleNone";
                U3D.InsertSystemMsg("和局");
                break;
            }
            BattleResult.GetComponent <Image>().material = Resources.Load <Material>(mat);
            BattleResult.SetActive(true);
            BattleTitle.SetActive(true);
        }
        Control("Close").SetActive(CombatData.Ins.GLevelMode != LevelMode.MultiplyPlayer);
        if (CombatData.Ins.GLevelMode == LevelMode.MultiplyPlayer)
        {
            Timer t = Timer.once(3.0f, ReEnterLevel);
        }
        Control("Close").GetComponent <Button>().onClick.AddListener(() =>
        {
            GameStateMgr.Ins.SaveState();
            Main.Ins.GameBattleEx.Pause();
            Main.Ins.StopAllCoroutines();
            SoundManager.Ins.StopAll();
            OnBackPress();
            if (FightState.Exist())
            {
                FightState.State.Close();
            }
            if (GameOverlayDialogState.Exist())
            {
                GameOverlayDialogState.Instance.ClearSystemMsg();
            }
            //离开副本
            if (U3D.IsMultiplyPlayer())
            {
            }
            else
            {
                FrameReplay.Ins.OnDisconnected();
                Main.Ins.GotoMenu();
            }
        });
        //Control("SaveRecord").SetActive(false);
        //Control("SaveRecord").GetComponent<Button>().onClick.AddListener(() => {
        //    Main.Ins.EnterState(Main.Ins.WaitDialogState, "正在保存录像,请稍后");
        //    //单独开一个线程去保存录像信息.
        //    RecordMgr.Ins.WriteFile();
        //    Control("SaveRecord").SetActive(false);//隐藏掉该按钮
        //});
    }
Exemple #8
0
    public void OnBattleStart()
    {
        ResetAll();
        wKey.OnPress.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyPress(EKeyList.KL_KeyW); });
        sKey.OnPress.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyPress(EKeyList.KL_KeyS); });
        aKey.OnPress.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyPress(EKeyList.KL_KeyA); });
        dKey.OnPress.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyPress(EKeyList.KL_KeyD); });

        wKey.OnPressing.AddListener(() => { CombatData.Ins.GMeteorInput.OnKeyPressingProxy(EKeyList.KL_KeyW); });
        sKey.OnPressing.AddListener(() => { CombatData.Ins.GMeteorInput.OnKeyPressingProxy(EKeyList.KL_KeyS); });
        aKey.OnPressing.AddListener(() => { CombatData.Ins.GMeteorInput.OnKeyPressingProxy(EKeyList.KL_KeyA); });
        dKey.OnPressing.AddListener(() => { CombatData.Ins.GMeteorInput.OnKeyPressingProxy(EKeyList.KL_KeyD); });

        wKey.OnRelease.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyRelease(EKeyList.KL_KeyW); });
        sKey.OnRelease.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyRelease(EKeyList.KL_KeyS); });
        aKey.OnRelease.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyRelease(EKeyList.KL_KeyA); });
        dKey.OnRelease.AddListener(() => { CombatData.Ins.GMeteorInput.OnAxisKeyRelease(EKeyList.KL_KeyD); });

        attack.OnPress.AddListener(() => { if (FightState.Exist())
                                           {
                                               FightState.Instance.OnAttackPress();
                                           }
                                   });
        attack.OnRelease.AddListener(() => { if (FightState.Exist())
                                             {
                                                 FightState.Instance.OnAttackRelease();
                                             }
                                     });

        defence.OnPress.AddListener(() => { if (FightState.Exist())
                                            {
                                                FightState.Instance.OnDefencePress();
                                            }
                                    });
        defence.OnRelease.AddListener(() => { if (FightState.Exist())
                                              {
                                                  FightState.Instance.OnDefenceRelease();
                                              }
                                      });

        jump.OnPress.AddListener(() => { if (FightState.Exist())
                                         {
                                             FightState.Instance.OnJumpPress();
                                         }
                                 });
        jump.OnRelease.AddListener(() => { if (FightState.Exist())
                                           {
                                               FightState.Instance.OnJumpRelease();
                                           }
                                   });

        changeweapon.OnPress.AddListener(() => { if (FightState.Exist())
                                                 {
                                                     FightState.Instance.OnChangeWeaponPress();
                                                 }
                                         });
        changeweapon.OnRelease.AddListener(() => { if (FightState.Exist())
                                                   {
                                                       FightState.Instance.OnChangeWeaponRelease();
                                                   }
                                           });

        brust.OnPress.AddListener(() => { if (FightState.Exist())
                                          {
                                              FightState.Instance.OnBreakOut();
                                          }
                                  });

        crouch.OnPress.AddListener(() => { if (FightState.Exist())
                                           {
                                               FightState.Instance.OnCrouchPress();
                                           }
                                   });
        crouch.OnRelease.AddListener(() => { if (FightState.Exist())
                                             {
                                                 FightState.Instance.OnCrouchRelease();
                                             }
                                     });

        dropweapon.OnPress.AddListener(() => { if (FightState.Exist())
                                               {
                                                   FightState.Instance.OnClickDrop();
                                               }
                                       });
        unlock.OnPress.AddListener(() => { if (FightState.Exist())
                                           {
                                               FightState.Instance.OnClickChangeLock();
                                           }
                                   });
        help.OnPress.AddListener(() => { if (FightState.Exist())
                                         {
                                             FightState.Instance.OnRebornClick();
                                         }
                                 });
    }
Exemple #9
0
    //使用作弊码
    public static bool UseCheatCode(string cheatcode)
    {
        bool    ret         = false;
        int     param1      = -1;
        int     param2      = -1;
        string  stringparam = "";
        Vector3 pos         = Vector3.zero;

        if (CheatOK(cheatcode, "check"))
        {
            U3D.ShowTargetBlood();
            return(true);
        }
        else if (CheatOK(cheatcode, "skill"))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            if (FightState.Exist())
            {
                FightState.Instance.ShowSkillBar();
            }
            return(true);
        }
        else if (CheatParam2(cheatcode, "follow", ref param1, ref param2))
        {
            MeteorUnit unit = U3D.GetUnit(param1 - 1);
            if (unit != null && unit.StateMachine != null)
            {
                MeteorUnit target = U3D.GetUnit(param2 - 1);
                U3D.InsertSystemMsg(string.Format("{0}开始跟随{1}", unit.name, target.name));
                unit.FollowTarget = target;
            }
            return(true);
        }
        else if (CheatParam2(cheatcode, "chase", ref param1, ref param2))
        {
            MeteorUnit unit = U3D.GetUnit(param1 - 1);
            if (unit != null)
            {
                MeteorUnit target = U3D.GetUnit(param2 - 1);
                if (target != null && !target.SameCamp(unit))
                {
                    U3D.InsertSystemMsg(string.Format("{0}开始追杀{1}", unit.name, target.name));
                    unit.Kill(target);
                }
            }
            return(true);
        }
        else if (CheatParam(cheatcode, "wait", ref param1))
        {
            MeteorUnit unit = U3D.GetUnit(param1 - 1);
            if (unit != null && unit.StateMachine != null)
            {
                U3D.InsertSystemMsg(string.Format("{0}空闲下来了", unit.name));
                unit.StateMachine.ChangeState(unit.StateMachine.WaitState);
            }
            return(true);
        }
        else if (CheatOK(cheatcode, "god"))
        {
            U3D.GodLike();
            ret = true;
        }
        else if (CheatOK(cheatcode, "box"))
        {
            U3D.Box();
            ret = true;
        }
        else if (CheatParam(cheatcode, "kill", ref param1))
        {
            if (U3D.IsMultiplyPlayer())
            {
                if (FrameReplay.Ins.Started)
                {
                    MeteorUnit unit = U3D.GetUnit(param1 - 1);
                    if (unit == null)
                    {
                        return(false);
                    }
                    OperateMsg msg = new OperateMsg();
                    msg.Operate    = (int)OperateType.Kill;
                    msg.KillTarget = (uint)unit.InstanceId;
                    FrameSyncServer.Ins.NetEvent(MeteorMsg.Command.Kill, msg);
                }
            }
            else
            {
                U3D.Kill(param1 - 1);
                MeteorUnit u = U3D.GetUnit(param1 - 1);
                if (u != null)
                {
                    U3D.InsertSystemMsg(string.Format("{0}遭遇击杀", u.name));
                }
            }
            ret = true;
        }
        else if (CheatParam(cheatcode, "pose", ref param1))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            if (Main.Ins.LocalPlayer != null && Main.Ins.LocalPlayer.ActionMgr != null)
            {
                Main.Ins.LocalPlayer.ActionMgr.ChangeAction(param1, 0.1f);
            }
            ret = true;
        }
        else if (CheatParam(cheatcode, "pause", ref param1))
        {
            MeteorUnit unit = U3D.GetUnit(param1 - 1);
            if (unit != null && unit.StateMachine != null)
            {
                unit.AIPause(true, float.MaxValue);
                U3D.InsertSystemMsg(string.Format("{0}无法动弹", unit.name));
            }
            ret = true;
        }
        else if (CheatParam(cheatcode, "resume", ref param1))
        {
            MeteorUnit unit = U3D.GetUnit(param1 - 1);
            if (unit != null && unit.StateMachine != null)
            {
                unit.AIPause(false, 0);
                U3D.InsertSystemMsg(string.Format("{0}恢复了", unit.name));
            }
            ret = true;
        }
        else if (CheatParam(cheatcode, "kick", ref param1))
        {
            if (U3D.IsMultiplyPlayer())
            {
                //检查自己是否房间主人,是则向主机发送指令
                if (FrameReplay.Ins.Started)
                {
                    MeteorUnit unit = U3D.GetUnit(param1 - 1);
                    if (unit == null)
                    {
                        return(false);
                    }
                    OperateMsg msg = new OperateMsg();
                    msg.Operate    = (int)OperateType.Kick;
                    msg.KillTarget = (uint)unit.InstanceId;
                    FrameSyncServer.Ins.NetEvent(MeteorMsg.Command.Kick, msg);
                }
            }
            ret = true;
        }
        else if (CheatParam(cheatcode, "skick", ref param1))
        {
            if (U3D.IsMultiplyPlayer())
            {
                //检查自己是否房间主人,是则向主机发送指令
                if (FrameReplay.Ins.Started)
                {
                    MeteorUnit unit = U3D.GetUnit(param1 - 1);
                    if (unit == null)
                    {
                        return(false);
                    }
                    OperateMsg msg = new OperateMsg();
                    msg.Operate    = (int)OperateType.Skick;
                    msg.KillTarget = (uint)unit.InstanceId;
                    FrameSyncServer.Ins.NetEvent(MeteorMsg.Command.Skick, msg);
                }
            }
            ret = true;
        }
        else if (CheatParamString(cheatcode, "ai", ref stringparam))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            if (Main.Ins.GameBattleEx != null)
            {
                int r = U3D.AddNPC(stringparam);
                ret = r > 0;
            }
            return(true);
        }
        else if (CheatOK(cheatcode, "fps"))
        {
            bool show = GameStateMgr.Ins.gameStatus.ShowFPS;
            show = !show;
            Main.Ins.ShowFps(show);
            return(true);
        }
        else if (CheatOK(cheatcode, "position"))
        {
            if (FightState.Exist())
            {
                FightState.Instance.ShowPosition();
            }
            return(true);
        }
        else if (CheatOK(cheatcode, "mhp"))
        {
            //不支持这个指令了.
            //if (FightState.Exist()) {
            //    FightState.Instance.ShowPlayerInfo();
            //}
            return(true);
        }
        else if (CheatOK(cheatcode, "mnet") || CheatOK("cheatcode", "serverinfo"))
        {
            //显示网络数据传送情况
            return(true);
        }
        else if (CheatOK(cheatcode, "quit"))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            Application.Quit();
            return(true);
        }
        else if (CheatParamVector3(cheatcode, "moveto", ref pos))
        {
            if (Main.Ins.LocalPlayer != null && !Main.Ins.LocalPlayer.Dead)
            {
                Main.Ins.LocalPlayer.SetPosition(pos);
            }
            return(true);
        }
        else if (CheatParam(cheatcode, "ang", ref param1))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            MeteorUnit target = U3D.GetUnit(param1 - 1);
            if (target != null)
            {
                target.angryMax = !target.angryMax;
                U3D.InsertSystemMsg(string.Format("{0}真气{1}", target.name, target.angryMax ? "满":"空"));
            }
            return(true);
        }
        else if (CheatParam(cheatcode, "weapon", ref param1))
        {
            if (Main.Ins.LocalPlayer != null)
            {
                InventoryItem w = GameStateMgr.Ins.MakeEquip(param1);
                if (w == null)
                {
                    U3D.InsertSystemMsg("找不到编号为:" + param1 + "的武器");
                    return(true);
                }
                Main.Ins.LocalPlayer.ChangeWeaponCode(param1);
            }
            return(true);
        }
        else if (CheatParam(cheatcode, "use", ref param1))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            if (Main.Ins.LocalPlayer != null)
            {
                Option it = MenuResLoader.Ins.GetItemInfo(param1);
                if (it == null)
                {
                    U3D.InsertSystemMsg("找不到编号为:" + param1 + "的物品");
                    return(true);
                }
                Main.Ins.LocalPlayer.GetItem(param1);
            }
            return(true);
        }
        else if (CheatParam(cheatcode, "drop", ref param1))
        {
            if (U3D.IsMultiplyPlayer())
            {
                if (Main.Ins.LocalPlayer != null)
                {
                    MeteorUnit player = Main.Ins.LocalPlayer;
                    DropMsg    msg    = new DropMsg();
                    msg.forward    = new _Vector3();
                    msg.forward.x  = Mathf.FloorToInt(player.transform.forward.x * 1000);
                    msg.forward.y  = Mathf.FloorToInt(player.transform.forward.y * 1000);
                    msg.forward.z  = Mathf.FloorToInt(player.transform.forward.z * 1000);
                    msg.position   = new _Vector3();
                    msg.position.x = Mathf.FloorToInt(player.transform.position.x * 1000);
                    msg.position.y = Mathf.FloorToInt(player.transform.position.y * 1000);
                    msg.position.z = Mathf.FloorToInt(player.transform.position.z * 1000);
                    msg.item       = (uint)param1;
                    FrameSyncServer.Ins.NetEvent(MeteorMsg.Command.Drop, msg);
                }
                return(true);
            }
            if (Main.Ins.LocalPlayer != null)
            {
                Option it = MenuResLoader.Ins.GetItemInfo(param1);
                if (it == null)
                {
                    U3D.InsertSystemMsg("找不到编号为:" + param1 + "的物品");
                    return(true);
                }
                DropMng.Ins.DropItem(Main.Ins.LocalPlayer, it);
            }
            return(true);
        }
        else if (CheatOK(cheatcode, "win"))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            if (Main.Ins.GameBattleEx != null)
            {
                Main.Ins.GameBattleEx.GameOver(1);
            }
            return(true);
        }
        else if (CheatOK(cheatcode, "lose"))
        {
            if (U3D.IsMultiplyPlayer())
            {
                return(false);
            }
            if (Main.Ins.GameBattleEx != null)
            {
                Main.Ins.GameBattleEx.GameOver(-1);
            }
        }
        return(ret);
    }