Exemple #1
0
        public override void LoadData()
        {
            if (AllowedToRun())
            {
                _timedBlockControllers.Add(new TimedBlockController(_timedBlockControllers.Count, true));

                //..add blocks by Id, and add times

                Cmd_SetTimes(BLOCK_TIMES.Split(' '));
            }
            else
            {
            }

            CommandsController.Init();

            if (!MyAPIGateway.Multiplayer.IsServer)
            {
                CommandsController.CreateCommand("ping", (cmdParams) =>
                {
                    Log.Write("Sending ping to server");
                    byte[] msgData = MyAPIGateway.Utilities.SerializeToBinary("ping");
                    MyAPIGateway.Multiplayer.SendMessageToServer(Log.MSG_LOG, msgData, true);
                });

                MyAPIGateway.Multiplayer.RegisterMessageHandler(Log.MSG_LOG, ServerMessageHandler);
            }

            #region Block Commands


            CommandsController.CreateCommand("tbListBlocks", (cmdParams) => { Cmd_ListBlocks(); }, false, true);

            #endregion

            #region Timed Block Commands

            CommandsController.CreateCommand("tbListTimes", (cmdParams) => { Cmd_ListTimes(); }, false, true);

            CommandsController.CreateCommand("tbGetNextTime", (cmdParams) => { Cmd_GetNextTime(); }, false, true);

            CommandsController.CreateCommand("tbStatus", (cmdParams) => { Cmd_GetStatus(); }, false, true);

            CommandsController.CreateCommand("tbEnable", (cmdParams) => { Cmd_Enable(); });

            CommandsController.CreateCommand("tbDisable", (cmdParams) => { Cmd_Disable(); });

            #endregion
        }