Exemplo n.º 1
0
    public void TryClimbLadder(Pathea.PeCmpt who)
    {
        Pathea.OperateCmpt oper = who.Entity.operateCmpt;
        if (oper == null || oper.HasOperate)
        {
            return;
        }

        if (null == oper.Entity.motionMgr)
        {
            return;
        }

        if (oper.Entity.motionMgr.IsActionRunning(Pathea.PEActionType.Climb))
        {
            climb.opClimb.StopOperate(oper, Pathea.Operate.EOperationMask.ClimbLadder);
        }
        else
        {
            climb.opClimb.StartOperate(oper, Pathea.Operate.EOperationMask.ClimbLadder);
        }

//		if (climb.opClimb.IsIdle ()) {
//			climb.opClimb.StartOperate(oper, Pathea.Operate.EOperationMask.ClimbLadder);
//		} else {
//			climb.opClimb.StopOperate(oper, Pathea.Operate.EOperationMask.ClimbLadder);
//		}
    }
    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);
        }
    }
Exemplo n.º 3
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 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);
                });
            }
        }
    }