public void beforeLoadLevel(string curLevel, string nextLevel)
    {
        ConsoleEx.DebugLog("BeforeLoadLevel. curlevel = " + curLevel + "   next level = " + nextLevel);

        LastScenesName = curLevel;
        CurScenesName  = nextLevel;

        if (curLevel == SceneName.GAME_BATTLE && nextLevel == SceneName.MAINUI)
        {
            TimeMgr.getInstance().setBaseLine(1.0f);
        }

        switch (nextLevel)
        {
        case SceneName.LOGIN_SCENE:
            Core.Data.soundManager.BGMPlay(SceneBGM.BGM_Login);
            break;

        case SceneName.GAME_BATTLE:
            Core.Data.soundManager.BGMPlay(SceneBGM.BGM_BATTLE);
            break;

        case SceneName.MAINUI:
            Core.Data.soundManager.BGMPlay(SceneBGM.BGM_GAMEUI);
            break;

        case SceneName.GameMovie:
            Core.Data.soundManager.BGMStop();
            break;
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        bool click = Input.GetMouseButtonDown(0);

        if (OverSkill_Key)
        {
            if (click)
            {
                if (BattleInfo == null || !BattleInfo.hasLiquidate)
                {
                    if (TimeMgr.getInstance().WarPause == false)                     //暂停的时候不能点击
                    {
                        OverSkill_Add++;
                    }
                }
            }
        }

        if (OverSkill_KeyUI)
        {
            if (click)
            {
                Core.Data.soundManager.BtnPlay(ButtonType.Confirm);
            }
        }

        if (Man_L != null && Man_R != null && Man_L.NowAnimType == CRLuoAnim_Main.Type.Idle && Man_R.NowAnimType == CRLuoAnim_Main.Type.Idle)
        {
            Screen_Brightness_ONOFF(true);
        }
    }
 /// <summary>
 /// 继续战斗
 /// </summary>
 public void OnContinue()
 {
     gameObject.SetActive(false);
     ///战斗暂停已结束
     TimeMgr.getInstance().WarPause = false;
     TimeMgr.getInstance().revertToBaseLine();
 }
Exemple #4
0
    /// <summary>
    /// 设定是否需要战斗加速
    /// </summary>
    void SetBattleStatus()
    {
        ///
        /// 计时模块,设定战斗的初始值为1.3F
        ///
        TemporyData temp       = Core.Data.temper;
        bool        featurewar = temp.currentBattleType == TemporyData.BattleType.FightWithFulisa;

        if (!featurewar)
        {
            TimeMgr.getInstance().setBaseLine(ButtonListener.BaseSpeed);
        }

        AccountConfigManager accMgr = Core.Data.AccountMgr;

        if (accMgr.UserConfig.SpeedUp > 0)
        {
            SpeedOrSkipMgr.OnAddSpeedButtonClick();
        }

        if (accMgr.UserConfig.AutoBat > 0)
        {
            SpeedOrSkipMgr.OnAutoButtonClick();
        }
    }
    public void OnGiveUp()
    {
        if (hasClick)
        {
            return;
        }
        hasClick = true;
        ///
        /// 跳过战斗的播放动画
        ///
        Core.Data.temper.SkipBattle    = true;
        BanBattleProcess.Instance.skip = true;
        ///
        /// 保存战斗的速度状态
        ///
        BanBattleManager battleMgr = BanBattleManager.Instance;

        battleMgr.SpeedOrSkipMgr.SpeedUpAndAutoSave();
        battleMgr.attackSideInfo.CancelInvoke();
        ///
        ///战斗暂停已结束
        ///
        TimeMgr.getInstance().WarPause = false;
        TimeMgr.getInstance().setBaseLine(1f);
        StopAllCoroutines();
        AsyncTask.RemoveAllDelayedWork();
        SettleBossBattle();
        updatePlayerLv();

        Core.SM.beforeLoadLevel(SceneName.GAME_BATTLE, SceneName.MAINUI);
        AsyncLoadScene.m_Instance.LoadScene(SceneName.MAINUI);
        Core.Data.temper.WarErrorCode = -1;
    }
Exemple #6
0
 void FixedUpdate()
 {
     if (m_game.m_state == Game.State.ST_Running)
     {
         if (TimeMgr.getTimeStampMicro() > m_curTime)
         {
             if (!m_game.m_bSer)
             {
                 Vector2 cltPos    = new Vector2(m_game.m_ball.position.x, m_game.m_ball.position.z);
                 Vector2 cltVel    = new Vector2(m_game.m_ball.rigidbody.velocity.x, m_game.m_ball.rigidbody.velocity.z);
                 float   deltaTime = (TimeMgr.getTimeStampMicro() - m_curTime) / 1000.0f;
                 Vector2 posB      = m_svrPos + m_svrVel * deltaTime;
                 Vector2 pos       = cltPos * (1 - m_rate) + posB * m_rate;
                 m_game.m_ball.position = new Vector3(pos.x, m_game.m_ball.position.y, pos.y);
                 Vector2 vel = cltVel * (1 - m_rate) + m_svrVel * m_rate;
                 Debug.Log(cltVel.y + "," + cltVel.y * (1 - m_rate));
                 m_game.m_ball.rigidbody.velocity = new Vector3(vel.x, m_game.m_ball.rigidbody.velocity.y, vel.y);
                 Debug.Log("CltPos:" + cltPos + ",SvrPos:" + m_svrPos + ",CltVel:" + cltVel
                           + ",SvrVel:" + m_svrVel);
             }
         }
         if (m_shots.Count > 0)
         {
             Vector2 dir = m_shots.Dequeue();
             Vector3 vec = m_game.m_ball.rigidbody.velocity;
             if (m_game.m_bottom && m_game.m_ball.position.z >= 0 || !m_game.m_bottom && m_game.m_ball.position.z <= 0)
             {
                 Vector3 direction = new Vector3(dir.x, 0, dir.y);
                 m_game.m_ball.rigidbody.velocity = direction;
             }
         }
     }
 }
 //重置
 public void ResetSpeedUp()
 {
     curLoop = 0;
     SpeedUp.GetComponent <UIButton>().normalSprite = "zhandoujiasu";
     //设定基线
     TimeMgr.getInstance().setBaseLine(1F);
 }
Exemple #8
0
    /// <summary>
    /// 暂停游戏
    /// </summary>
    public void OnPauseClick()
    {
        pausePanelView.gameObject.SetActive(true);
        pausePanelView.init();

        Time.timeScale = 0f;
        TimeMgr.getInstance().WarPause = true;
    }
Exemple #9
0
    void Start()
    {
        s_curTiliMgr = this;

        _timeMgr = _timeMgrObject.GetComponent <TimeMgr>();
        InvokeRepeating("Timer", _invokeRepeatDeltaTime, _invokeRepeatDeltaTime);
        happinessChange(UserData.getInstance().getHappinessNum());
    }
Exemple #10
0
    void SetupSingletons()
    {
        GameController gameCtrl = Singleton.GetInstance("GameController") as GameController;
        TimeMgr        timeMgr  = Singleton.GetInstance("TimeMgr") as TimeMgr;

        timeMgr.StartTimer();
        timeMgr.AddTimeEvent(TimeMgr.TimeEvent.NewTimeEvent("AA", gameCtrl.StartGame, 1));
    }
Exemple #11
0
 private void end()
 {
     isStart = false;
     if (OnEnd != null)
     {
         OnEnd();
     }
     TimeMgr.RemoveTimer(this);
 }
 public void Connect(string host, string port)
 {
     Client.Instance.Connect(host, port);
     if (client.isConnect)
     {
         timeMgr = new TimeMgr();
         timeMgr.StartTimer();
     }
 }
Exemple #13
0
    void QueueEnd(TimerTask t)
    {
        //回归基线

        ///
        ///如果战斗没有暂停的话,回归
        if (!TimeMgr.getInstance().WarPause)
        {
            TimeMgr.getInstance().revertToBaseLine();
        }
    }
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Exemple #15
0
 public void Start()
 {
     isStart   = true;
     startTime = Time.time;
     curTime   = startTime;
     endTime   = curTime + duration;
     TimeMgr.AddTimer(this);
     if (OnStart != null)
     {
         OnStart();
     }
 }
Exemple #16
0
 void Update()
 {
     if (m_state == State.ST_Start)
     {
         m_state           = State.ST_Running;
         m_time            = 0;
         m_input.m_enabled = true;
         if (m_bottom)
         {
             m_other.position = m_tranUp.position;
             m_other.rotation = m_tranUp.rotation;
             Camera.main.transform.position = m_tranBottom.position;
             Camera.main.transform.rotation = m_tranBottom.rotation;
         }
         else
         {
             m_other.position = m_tranBottom.position;
             m_other.rotation = m_tranBottom.rotation;
             Camera.main.transform.position = m_tranUp.position;
             Camera.main.transform.rotation = m_tranUp.rotation;
         }
         m_ball.position = m_tranBall.position;
         m_ball.rotation = m_tranBall.rotation;
     }
     if (m_state == State.ST_Running)
     {
         if (m_time > m_gameTime)
         {
             m_state = State.ST_End;
             CmdPacket packet = new CmdPacket();
             //packet.WriteUShort(Proto.C_AutoMatch);
             //m_client.m_client.Send(packet);
         }
         m_time += Time.deltaTime;
         //同步位置和速度
         if (m_bSer)
         {
             //if (Time.realtimeSinceStartup - m_lstSyncTime > Time.deltaTime)
             {
                 CmdPacket packet = new CmdPacket();
                 packet.WriteUShort(Proto.Synch_Pos);
                 packet.WriteUInt64(TimeMgr.getTimeStampMicro());
                 packet.WriteFloat(m_ball.position.x);
                 packet.WriteFloat(m_ball.position.z);
                 packet.WriteFloat(m_ball.rigidbody.velocity.x);
                 packet.WriteFloat(m_ball.rigidbody.velocity.z);
                 m_client.send(packet);
                 m_lstSyncTime = Time.realtimeSinceStartup;
             }
         }
     }
 }
 public void Launch()
 {
     if (isLaunched)
     {
         return;
     }
     eventHandler = ClientBase.EventHandler.GetEventHandler();
     client       = Client.Instance;
     timeMgr      = new TimeMgr();
     timeMgr.StartTimer();
     InitClient();
     SendMsg("olleH! revreS");
     isLaunched = true;
 }
Exemple #18
0
            public DateTime?Convert(string source, DateTime?destination, ResolutionContext context)
            {
                if (string.IsNullOrWhiteSpace(source))
                {
                    return(null);
                }

                DateTime dateTime;

                if (!DateTime.TryParse($"{TimeMgr.GetLoaclDateTime().ToString("yyyy-MM-dd")} {source}", out dateTime))
                {
                    return(null);
                }

                return(dateTime);
            }
Exemple #19
0
    void Update()
    {
        ulong dtTime = TimeMgr.SinceTimeMs(mLastUpdateTime);

        mLastUpdateTime = TimeMgr.CurTimeMs;

        SocketMgr.Update();
        StateMgr.Update();
        ResMgr.Update();
        HttpMgr.Update();
        if (null != GameSceneMgr)
        {
            GameSceneMgr.Update(dtTime);
        }
        TimerManager.Instance.Update(dtTime);
    }
Exemple #20
0
    public void addAchievementNum(AchievementType type, int count)
    {
        int num = PlayerPrefs.GetInt(KEY_ACHIEVENT_TYPE_NUM + type, 0);

        num += count;
        PlayerPrefs.SetInt(KEY_ACHIEVENT_TYPE_NUM + type, num);

        for (int i = 0; i < _achievementArray.Count; i++)
        {
            if (_achievementArray[i].type == type && _achievementArray[i].typeConfig <= num && PlayerPrefs.GetInt(KEY_ACHIEVENT_GET_DAY + _achievementArray[i].id, -1) == -1)
            {
                PlayerPrefs.SetInt(KEY_ACHIEVENT_GET_DAY + _achievementArray[i].id, TimeMgr.getCurTimeMgr().getCurDayFromStartDay());
                _achievementArray[i].compliteday = TimeMgr.getCurTimeMgr().getCurDayFromStartDay();
                getRewardById(_achievementArray[i].id);
            }
        }
    }
    /// <summary>
    /// 获取时间详细数据
    /// year 包括纪元的四位数的年份
    /// month 月份数字,一位数的月份有一个前导零
    /// day 月中的某一天,一位数的日期有一个前导零
    /// hour : 24小时制
    /// minute : 分钟
    /// Second : 秒
    /// </summary>
    public static LPCMapping GetTimeDetail(int sec, bool show24)
    {
        // 转换为DateTime
        DateTime   dt   = TimeMgr.ConvertIntDateTime(sec);
        LPCMapping data = LPCMapping.Empty;

        // 2018-10-12 24:00:00
        // 不需要修正向下修正格式化后2018-10-13 00:00:00
        // 向下修正后显示2018-10-12 24:00:00
        if (!show24)
        {
            data.Add("year", dt.Year);
            data.Add("month", dt.Month);
            data.Add("day", dt.Day);
            data.Add("hour", dt.Hour);
            data.Add("minute", dt.Minute);
            data.Add("Second", dt.Second);
            return(data);
        }

        // 如果时间不是00:00:00, 直接返回当前时间
        if (dt.Hour != 0 || dt.Minute != 0 || dt.Second != 0)
        {
            data.Add("year", dt.Year);
            data.Add("month", dt.Month);
            data.Add("day", dt.Day);
            data.Add("hour", dt.Hour);
            data.Add("minute", dt.Minute);
            data.Add("Second", dt.Second);
            return(data);
        }

        // 转换为DateTime,在原来时间减1秒让时间推移到上一天
        DateTime dt1 = TimeMgr.ConvertIntDateTime(sec - 1);

        // 构建数据
        data.Add("year", dt1.Year);
        data.Add("month", dt1.Month);
        data.Add("day", dt1.Day);
        data.Add("hour", 24);
        data.Add("minute", 0);
        data.Add("Second", 0);

        // 返回格式化后数据
        return(data);
    }
Exemple #22
0
    void QueueNormal(TimerTask t)
    {
        AsyncTask.QueueOnMainThread(() => {
            if (timer <= 0)
            {
                if (Time.timeScale < TimeMgr.getInstance().getExtLine(BanTimeCenter.Scale_Down_To))
                {
                    TimeMgr.getInstance().setExtLine(BanTimeCenter.Scale_Down_To);
                }
            }
            else
            {
                TimeMgr.getInstance().setExtLine(BanTimeCenter.Scale_Down_Slow);
            }

            timer = 0;
        });
    }
Exemple #23
0
    /// <summary>
    /// 回收协程
    /// </summary>
    /// <returns>The daemon.</returns>
    private IEnumerator RecycleDaemon()
    {
        // 永固不停歇的回收资源
        while (true)
        {
            // TODO,还需要按“最远未使用”进行过滤resource
            yield return(TimeMgr.WaitForRealSeconds(10f));

            // 不需要回收资源
            if (!mAutoRecycle)
            {
                continue;
            }

            // 回收资源
            Recycle(false);
        }
    }
Exemple #24
0
    public void StartGame(float deltaTime)
    {
        map     = new Map();
        map.col = 14;
        map.row = 16;
        map.Init(GameObject.Find("Canvas/Map").transform);

        selfEmitter = new GridEmitter();
        selfEmitter.Init(true);

        enermyEmitter = new GridEmitter();
        enermyEmitter.Init(false);

        TimeMgr timeMgr = Singleton.GetInstance("TimeMgr") as TimeMgr;

        TimeMgr.TimeEvent timeEvt = TimeMgr.TimeEvent.NewTimeEvent("SelfEmitter", SelfSpawnGrids, 0, 3);
        timeMgr.AddTimeEvent(timeEvt);

        timeEvt = TimeMgr.TimeEvent.NewTimeEvent("EnermyEmitter", EnermySpawnGrids, 0, 3);
        timeMgr.AddTimeEvent(timeEvt);

        GameObject.Find("Canvas/bg").GetComponent <SwipeRecognizer>().OnGesture += OnSwipe;
    }
    void SpeedUpClick()
    {
        if (OpenSpeedUp)
        {
            //当前的速度
            float curFactor = 1.0f;
            if (curLoop == 0)
            {
                curFactor = BaseSpeed + deltaSpeed;
                curLoop   = 1;
            }
            else
            {
                curFactor = BaseSpeed;
                curLoop   = 0;
            }

            if (curLoop == 0)
            {
                SpeedUp.GetComponent <UIButton>().normalSprite = "zhandoujiasu";
            }
            else
            {
                SpeedUp.GetComponent <UIButton>().normalSprite = "zhandoujiasu2";
            }

            //设定基线
            TimeMgr.getInstance().setBaseLine(curFactor);

            StartCoroutine(FadeIn());
        }
        else
        {
            StartCoroutine(VipOpenSpeedUp());
        }
    }
Exemple #26
0
        public virtual void ExecuteBaseMap(EntityTypeBuilder <T> builder, string tableName)
        {
            builder.ToTable(tableName);

            #region 主键设置
            // builder.HasKey(p => p.Id);
            //builder.Property(p => p.Id).ValueGeneratedOnAdd(); //主键ID自动增长生成
            #endregion

            #region 数据状态设置(需要去数据可配置默认值“Enable”)
            //定义枚举到数据的转换器
            var stateConverter = new ValueConverter <DataState, int> (p => (int)p, p => (DataState)p);
            //设置插入的时候使用数据库的默认值,也就是说生成数据局后还要去设置默认值
            builder.Property(p => p.State).HasDefaultValue(DataState.Enable).IsRequired();
            #endregion

            #region 数据创建时间配置 (需要去数据可配置默认值“getdate ()”)
            builder.Property(p => p.CreateTime).HasDefaultValue(TimeMgr.GetLoaclDateTime()).ValueGeneratedOnAdd().IsRequired();
            #endregion

            #region 数据最后更新时间配置
            builder.Property(p => p.LastUpdateTime).HasDefaultValue(TimeMgr.GetLoaclDateTime()).ValueGeneratedOnAddOrUpdate().IsRequired();
            #endregion
        }
Exemple #27
0
    private void startTimer()
    {
        ///
        /// --- 如果是自动战斗,则不让时间流逝的变慢 ----
        ///
        AccountConfigManager accMgr = Core.Data.AccountMgr;
        bool makeTimeQucik          = accMgr.UserConfig.AutoBat == (short)1;

        if (makeTimeQucik == false)
        {
            TimeMgr.getInstance().setExtLine(BanTimeCenter.Scale_Down_Slow);
        }

        long      now  = Core.TimerEng.curTime;
        long      end  = now + 8;
        TimerTask task = new TimerTask(now, end, 1, ThreadType.MainThread);

        if (makeTimeQucik == false)
        {
            task.onEvent = QueueNormal;
        }
        task.onEventEnd = QueueEnd;
        task.DispatchToRealHandler();
    }
Exemple #28
0
 private void Awake()
 {
     Instance = this;
 }
Exemple #29
0
 void Awake()
 {
     Instance = this;
     handers  = new List <TimerHandler>();
 }
Exemple #30
0
 // ------------------------------------------------------------------------------------------------------------------------------------------
 // Use this for initialization
 // ------------------------------------------------------------------------------------------------------------------------------------------
 void Awake()
 {
     // set singleton
     s_instance = this;
 }
Exemple #31
0
 // Awake is called when the script instance is being loaded.
 void Awake()
 {
     mInstance = this;
 }