コード例 #1
0
ファイル: UpdateWorld.cs プロジェクト: xjuantxu/MIM
        public static async Task UpdateRoom()
        {
            await Task.Delay(300000);

            RestoreVitals.UpdateRooms();

            HubContext.getHubContext.Clients.All.addNewMessageToPage("This is will update Rooms every 5 minutes and not block the game");

            CleanRoom();
        }
コード例 #2
0
        public static async Task UpdateRoom()
        {
            await Task.Delay(5000);

            try
            {
                RestoreVitals.UpdateRooms();

                CleanRoom();
            }
            catch (Exception ex)
            {
            }
        }
コード例 #3
0
        public static void UpdateTIme()
        {
            ticksElapsedSinceSave += 1;
            tickCount             += 1;

            if (tickCount == 48)
            {
                tickCount = 0;
            }

            if (tickCount != 0)
            {
                if (minute == 30)
                {
                    hour += 1;

                    if (hour == 24)
                    {
                        hour = 0;
                    }
                }

                minute += 30;

                if (minute == 60)
                {
                    minute = 0;
                }
            }

            if (tickCount <= 35)
            {
                switch (tickCount)
                {
                case 0:
                case 1:
                case 2:
                case 3:
                    HubContext.Instance.AddNewMessageToPage(
                        "The moon is slowly moving west across the sky.");
                    break;

                case 9:
                    HubContext.Instance.AddNewMessageToPage("The moon slowly sets in the west.");
                    break;

                case 11:
                    HubContext.Instance.AddNewMessageToPage("The sun slowly rises from the east.");
                    break;

                case 13:
                    HubContext.Instance.AddNewMessageToPage(
                        "The sun has risen from the east, the day has begun.");
                    break;

                case 24:
                    HubContext.Instance.AddNewMessageToPage("The sun is high in the sky.");
                    break;

                default:
                    HubContext.Instance.AddNewMessageToPage(
                        "The sun is slowly moving west across the sky.");
                    break;
                }
            }
            else
            {
                switch (tickCount)
                {
                case 36:
                    HubContext.Instance.AddNewMessageToPage("The sun slowly sets in the west.");
                    break;

                case 40:
                    HubContext.Instance.AddNewMessageToPage("The moon slowly rises in the west.");
                    break;

                case 43:
                    HubContext.Instance.AddNewMessageToPage(
                        "The moon has risen from the east, the night has begun.");
                    break;

                default:
                    HubContext.Instance.AddNewMessageToPage("The moon is high in the sky.");
                    break;
                }
            }


            if (tickCount == ticksInDay)
            {
                //New day reset
                tickCount = 0;
            }


            if (autoSaveTick == ticksElapsedSinceSave)
            {
                //SAve world/ players
            }



            RestoreVitals.UpdatePlayers();
            //heal players / mobs
        }