예제 #1
0
 public void ShowSleepWnd(bool show, MonoBehaviour operater = null, PESleep peSleep = null, Pathea.PeEntity character = null, System.Action <float> sleep = null)
 {
     //lz-2016.06.01 不经过菜单直接打开SleepWnd的时候要先打开ItemOP
     if (!isShow)
     {
         Show();
     }
     if (show && operater != null)
     {
         if (!mInit)
         {
             InitWindow();
         }
         mSleepWnd.SetActive(true);
         mMainWnd.SetActive(false);
         InitSleepTime();
         m_PeSleep = peSleep;
         mEntity   = character;
         //mDoSleep = sleep;
         SetOperater(operater);
     }
     else
     {
         mSleepWnd.SetActive(false);
     }
 }
예제 #2
0
    public static void StartSleep(PESleep peSleep, PeEntity character, float hours = 12)
    {
        if (null != character)
        {
            SleepController sc = character.GetComponent <SleepController>();
            if (sc == null)
            {
                sc = character.gameObject.AddComponent <SleepController>();
                sc.isMainPlayer = Pathea.PeCreature.Instance.mainPlayer == character;

                if (sc.isMainPlayer)
                {
                    MotionMgrCmpt mmc         = character.GetCmpt <MotionMgrCmpt>();
                    Action_Sleep  actionSleep = mmc.GetAction <Action_Sleep>();
                    actionSleep.startSleepEvt += sc.MainPlayerStartSleep;
                    actionSleep.startSleepEvt += (i) => FastTravelMgr.Instance.Add(sc);
                    actionSleep.endSleepEvt   += sc.MainPlayerEndSleep;
                    actionSleep.endSleepEvt   += (i) => FastTravelMgr.Instance.Remove(sc);
                }
            }

            sc.character    = character.GetComponent <OperateCmpt>();
            sc.maxSleepTime = hours * 3600f;
            sc.timeCount    = 0;
            sc.peSleep      = peSleep;
            sc.enabled      = true;
            sc.actionTime   = 2f;
            peSleep.StartOperate(sc.character, EOperationMask.Sleep);
//			peSleep.Do(sc.character);
        }
    }
예제 #3
0
    public void SleepImmediately(PESleep peSleep, Pathea.PeEntity character)
    {
        if (!mInit)
        {
            InitWindow();
        }

        mMainWnd.SetActive(false);
        SleepController.StartSleep(peSleep, Pathea.MainPlayer.Instance.entity, SleepTime.NormalHours);
    }
예제 #4
0
    void ResetDefaultState()
    {
        m_Operater = null;
        mEntity    = null;
        mCmdList   = null;
        mOpen      = null;
        mDoGet     = null;
        //mDoSleep = null;
        m_SpeepEvent = null;
        m_PeSleep    = null;

        mSleepWnd.SetActive(false);
        mMainWnd.SetActive(true);
        mSlider.gameObject.SetActive(false);
    }
예제 #5
0
    void MainPlayerEndSleep(int buffID)
    {
        MousePicker.Instance.enable = true;
        GameUI.Instance.mItemOp.HideSleepingUI();

        if (!PeGameMgr.IsMulti)
        {
            if (GameTime.Timer.ElapseSpeedBak >= 0f)
            {
                GameTime.Timer.ElapseSpeed    = GameTime.Timer.ElapseSpeedBak;
                GameTime.Timer.ElapseSpeedBak = -1f;
            }
            GameTime.AbnormalityTimePass = false;
        }
        peSleep = null;
    }