Ejemplo n.º 1
0
    protected bool Operatable()
    {
        if (operation == null)
        {
            return(false);
        }

        if (!operation.CanOperateMask(m_Mask))
        {
            return(false);
        }

        Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt;
        if (null != operateCmpt && operateCmpt.HasOperate)
        {
            return(false);
        }

        Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.motionMgr;

        if (null != mmc && (mmc.IsActionRunning(m_ActionType) || !mmc.CanDoAction(m_ActionType)))
        {
            return(false);
        }

        return(true);
    }
    protected override void CheckOperate()
    {
        base.CheckOperate();

        if (PeInput.Get(PeInput.LogicFunction.InteractWithItem) && CanCmd())
        {
            if (EntityMonsterBeacon.IsRunning())
            {
                PeTipMsg.Register(PELocalization.GetString(8000596), PeTipMsg.EMsgLevel.Warning);
                return;
            }

            if (!Operatable())
            {
                return;
            }

            Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt;
            if (null != operateCmpt && operateCmpt.HasOperate)
            {
                return;
            }

            Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.motionMgr;

            if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep)))
            {
                return;
            }

            GameUI.Instance.mItemOp.ShowSleepWnd(true, this, bedView.peSleep, Pathea.MainPlayer.Instance.entity);
            // GameUI.Instance.mItemOp.SleepImmediately(bedView.peSleep, Pathea.MainPlayer.Instance.entity);
        }
    }
Ejemplo n.º 3
0
        bool DoGetOn(int railRouteId, bool checkState = true)
        {
            if (checkState && !mMotionMgr.CanDoAction(PEActionType.GetOnTrain))
            {
                return(false);
            }

            Railway.Route route = Railway.Manager.Instance.GetRoute(railRouteId);
            if (route == null)
            {
                Debug.LogError("cant find route to get on, route id:" + railRouteId);
                return(false);
            }

            if (!route.AddPassenger(this))
            {
                Debug.LogError("get on failed, route id:" + railRouteId);
                return(false);
            }

            mRailRouteId = railRouteId;

            return(true);
        }
Ejemplo n.º 4
0
        void UpdateOtherAction()
        {
                        #if UNITY_EDITOR
            if (Input.GetKeyDown(KeyCode.Keypad5))
            {
                mPackage.Add(1277, 1);
                PeMap.StaticPoint.Mgr.Instance.UnveilAll();
            }
                        #endif

            if (PeCamera.isFreeLook || !m_ActionEnable)
            {
                return;
            }


            if (PeInput.Get(PeInput.LogicFunction.Jet))
            {
                mMotionMgr.DoAction(PEActionType.JetPack);
            }
            else
            {
                mMotionMgr.EndImmediately(PEActionType.JetPack);
            }

            if (PeInput.Get(PeInput.LogicFunction.ClimbForwardLadderOnOff))
            {
                DragItemMousePickLadder ladder = MousePicker.Instance.curPickObj as DragItemMousePickLadder;
                if (null != ladder)
                {
                    ladder.TryClimbLadder(this);
                }
            }

            mEquip.HoldSheild(PeInput.Get(PeInput.LogicFunction.Block));

            if (PeInput.Get(PeInput.LogicFunction.DrawWeapon))
            {
                if (m_DisableActionByUI && mEquip.ISAimWeapon)
                {
                    m_DisableActionByUI = false;
                }
                mEquip.ActiveWeapon(true);
            }

            if (PeInput.Get(PeInput.LogicFunction.Attack))
            {
                if (SystemSettingData.Instance.AttackWhithMouseDir)
                {
                    Vector3 dir = GetMouseClickDir();
                    mEquip.SwordAttack(dir);
                    mEquip.TwoHandWeaponAttack(dir);
                }
                else
                {
                    mEquip.SwordAttack(m_MoveDir.normalized);
                    mEquip.TwoHandWeaponAttack(m_MoveDir.normalized);
                }
            }

            if (PeInput.Get(PeInput.LogicFunction.SheatheWeapon))
            {
                mEquip.ActiveWeapon(false);
            }

            if (PeInput.Get(PeInput.LogicFunction.GatherHerb))
            {
                mMotionMgr.DoAction(PEActionType.Gather);
            }

            if (PeInput.Get(PeInput.LogicFunction.DrawWater))
            {
                mMotionMgr.DoAction(PEActionType.Draw);
            }

            if (PeInput.Get(PeInput.LogicFunction.TakeForwardVehicleOnOff))
            {
                if (null != mPassenger)
                {
                    if (mPassenger.IsOnVCCarrier)
                    {
                        mPassenger.GetOffCarrier();
                    }
                    else if (null != MousePicker.Instance.curPickObj)
                    {
                        DragItemMousePickCarrier carrier = MousePicker.Instance.curPickObj as DragItemMousePickCarrier;
                        if (null != carrier)
                        {
                            WhiteCat.CarrierController controller = carrier.GetComponent <WhiteCat.CarrierController> ();
                            if (null != controller)
                            {
                                int seatIndex = controller.FindEmptySeatIndex();
                                if (seatIndex > -2)
                                {
                                    if (GameConfig.IsMultiMode)
                                    {
                                        PEActionParamDrive param = PEActionParamDrive.param;
                                        param.controller = controller;
                                        param.seatIndex  = seatIndex;
                                        if (mMotionMgr.CanDoAction(PEActionType.Drive, param))
                                        {
                                            WhiteCat.CreationSkEntity skEntity = controller.GetComponent <WhiteCat.CreationSkEntity>();
                                            if (skEntity != null && skEntity._net != null)
                                            {
                                                if (!ForceSetting.Instance.Conflict(skEntity._net.TeamId, PlayerNetwork.mainPlayerId))
                                                {
                                                    PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_GetOnVehicle, skEntity._net.Id);
                                                }
                                                else
                                                {
                                                    new PeTipMsg(PELocalization.GetString(82209000), PeTipMsg.EMsgLevel.Warning);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        mPassenger.GetOn(controller, seatIndex, true);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (PeInput.Get(PeInput.LogicFunction.Cut))
            {
                mMotionMgr.DoAction(PEActionType.Fell);
            }
            else
            {
                mMotionMgr.EndAction(PEActionType.Fell);
            }

            if (PeInput.Get(PeInput.LogicFunction.EndShooting))
            {
                mMotionMgr.EndAction(PEActionType.GunFire);
                mMotionMgr.EndAction(PEActionType.Pump);
            }
            else if (PeInput.Get(PeInput.LogicFunction.BegShooting))
            {
                PEActionParamB param = PEActionParamB.param;
                param.b = false;
                mMotionMgr.DoAction(PEActionType.GunFire, param);
                mMotionMgr.DoAction(PEActionType.BowShoot);
                mMotionMgr.DoAction(PEActionType.Throw);
                mMotionMgr.DoAction(PEActionType.Pump);
                mMotionMgr.DoAction(PEActionType.RopeGunShoot);
            }

            if (m_MouseMoveMode)
            {
                if (PeInput.Get(PeInput.LogicFunction.BegShooting))
                {
                    mMove.MoveTo(m_MouseHitPos, SpeedState.Sprint);
                }
                if (Input.GetMouseButtonDown(1))
                {
                    mMove.MoveTo(Vector3.zero, SpeedState.Sprint);
                }
            }

            if (PeInput.Get(PeInput.LogicFunction.EndDigging))
            {
                mMotionMgr.EndAction(PEActionType.Dig);
            }
            else if (PeInput.Get(PeInput.LogicFunction.BegDigging))
            {
                PEActionParamV param = PEActionParamV.param;
                param.vec = Vector3.zero;
                mMotionMgr.DoAction(PEActionType.Dig, param);
            }

            if (PeInput.Get(PeInput.LogicFunction.Reload))
            {
                mEquip.Reload();
            }

            if (PeInput.Get(PeInput.LogicFunction.BuildMode))
            {
                if (mMotionMgr.IsActionRunning(PEActionType.Build))
                {
                    mMotionMgr.EndAction(PEActionType.Build);
                }
                else
                {
                    if (RandomDungenMgrData.InDungeon)
                    {
                        new PeTipMsg("[C8C800]" + PELocalization.GetString(82209004), PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Stroy);
                        return;
                    }
                    if (Pathea.SingleGameStory.curType == Pathea.SingleGameStory.StoryScene.MainLand ||
                        Pathea.SingleGameStory.curType == Pathea.SingleGameStory.StoryScene.TrainingShip)
                    {
                        mMotionMgr.DoAction(PEActionType.Build);
                    }
                    else
                    {
                        new PeTipMsg("[C8C800]" + PELocalization.GetString(82209004), PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Stroy);
                    }
                }
            }
        }
    protected override void InitCmd(CmdList cmdList)
    {
        cmdList.Add("Turn", Turn90Degree);
        cmdList.Add("Get", OnGetBtn);

        //if (!GameConfig.IsMultiMode)
        {
            if (bedView.peSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep))
            {
                cmdList.Add("Sleep", () =>
                {
                    if (EntityMonsterBeacon.IsRunning())
                    {
                        PeTipMsg.Register(PELocalization.GetString(8000596), PeTipMsg.EMsgLevel.Warning);
                        return;
                    }
                    if (!bedView.peSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep))
                    {
                        return;
                    }

                    Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt;
                    if (null != operateCmpt && operateCmpt.HasOperate)
                    {
                        return;
                    }

                    Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.GetCmpt <Pathea.MotionMgrCmpt>();

                    if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep)))
                    {
                        return;
                    }

                    //if (GameConfig.IsMultiMode)
                    //     GameUI.Instance.mItemOp.SleepImmediately(bedView.peSleep, Pathea.MainPlayer.Instance.entity);
                    //else
                    GameUI.Instance.mItemOp.ShowSleepWnd(true, this, bedView.peSleep, Pathea.MainPlayer.Instance.entity);
                });
            }
        }
    }