Пример #1
0
 public MovableSystemServer(GameWorld world, BundledResourceManager bundledResourceManager)
 {
     m_GameWorld = world;
     m_BundledResourceManager = bundledResourceManager;
     Console.AddCommand("spawnbox", CmdSpawnBox, "Spawn <n> boxes", GetHashCode());
     Console.AddCommand("despawnboxes", CmdDespawnBoxes, "Despawn all boxes", GetHashCode());
 }
Пример #2
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            DontDestroyOnLoad(gameObject);
        }

        Log("--- Console Initalized ---");
        Console.AddCommand(new ConsoleCommand("help", "gets help info",
                                              CmdParameterType.None, gameObject,
                                              "DisplayHelp"));

        Console.AddCommand(new ConsoleCommand("sendmessage", "calls a send message on a game object, parameters (gameObject name) (message)",
                                              CmdParameterType.String, gameObject,
                                              "ForwardSendMessage"));

        if (logDebug)
        {
            Application.RegisterLogCallback(OnDebugLog);
            Console.Log("--- Unity Logger Registered ---");
        }
    }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello from C#!", Console.LogLevel.Info);
            Console.WriteLine(string.Format("args = [{0}]", string.Join(",", args)), Console.LogLevel.Info);

            Console.AddCommand("test", TestCommand);
            Console.Execute("print t");

            Events.Add <Input.KeyEvent>(KeyCallback);
            Events.Add <TestEvent>(TestEventCallback);

            DiscordEventHandler discordEventHandler = new DiscordEventHandler();

            DiscordRPC.Init("424302031822520320", ref discordEventHandler, true, "480");

            DiscordPresence presence = new DiscordPresence();

            presence.details       = "Jazz weeb";
            presence.state         = ":3c:";
            presence.largeImageKey = "icon-large";
            presence.smallImageKey = "icon-small";

            DiscordRPC.UpdatePresence(ref presence);

            SteamworksClient = new Client(480);
        }
Пример #4
0
    public GameStatistics()
    {
        m_FrequencyMS = System.Diagnostics.Stopwatch.Frequency / 1000;
        //System.Diagnostics.Stopwatch.Frequency	10000000	long
        //m_FrequencyMS	10000	long
        //초당 tick수를 나타낸다. 1000으로 나누면 ms당 tick 값이다. 그래서 이름이 m_FrequencyMS 이군.
        m_StopWatch = new System.Diagnostics.Stopwatch();
        //stopwatch를 생성한다.
        m_StopWatch.Start();
        //stopwatch를 시작한다.
        m_LastFrameTicks = m_StopWatch.ElapsedTicks;
        // Gets the total elapsed time measured by the current instance, in timer ticks.
        m_FrameTimes = new float[_no_frames];
        //_no_frames = 128, 128개의 float 배열
        m_TicksPerFrame = new float[2][] { new float[_no_frames], new float[_no_frames] };
        //128개의 배열이 2개

        m_GraphicsDeviceName = SystemInfo.graphicsDeviceName;//		SystemInfo.graphicsDeviceName	"NVIDIA GeForce GTX 670M"	string

        for (int i = 0; i < recordersList.Length; i++)
        {
            var sampler = Sampler.Get(recordersList[i].name);
            //Sampler 이름을 사전에 RecorderEntry[] recordersList에 정의해 뒀는데, 이것으로 Sampler를 얻어 온다.

            if (sampler != null)
            {
                recordersList[i].recorder = sampler.GetRecorder();
            }
        }

        Console.AddCommand("show.profilers", CmdShowProfilers, "Show available profilers.");
    }
Пример #5
0
    public CharacterModulePreview(GameWorld world, BundledResourceManager resourceSystem) : base(world)
    {
        // Handle spawn requests
        m_HandleCharacterSpawnRequests  = m_world.GetECSWorld().CreateSystem <HandleCharacterSpawnRequests>(m_world, resourceSystem, false);
        m_HandleCharacterDepawnRequests = m_world.GetECSWorld().CreateSystem <HandleCharacterDespawnRequests>(m_world);

        // Handle spawning
        CharacterBehaviours.CreateHandleSpawnSystems(m_world, m_HandleSpawnSystems, resourceSystem, false);

        // Handle despawn
        CharacterBehaviours.CreateHandleDespawnSystems(m_world, m_HandleDespawnSystems);

        // Behaviors
        CharacterBehaviours.CreateAbilityRequestSystems(m_world, m_AbilityRequestUpdateSystems);
        //m_MovementStartSystems.Add(m_world.GetECSWorld().CreateManager<UpdateTeleportation>(m_world));
        CharacterBehaviours.CreateMovementStartSystems(m_world, m_MovementStartSystems);
        CharacterBehaviours.CreateMovementResolveSystems(m_world, m_MovementResolveSystems);
        CharacterBehaviours.CreateAbilityStartSystems(m_world, m_AbilityStartSystems);
        //CharacterBehaviours.CreateAbilityResolveSystems(m_world, m_AbilityResolveSystems);

        m_UpdateCharPresentationState = m_world.GetECSWorld().CreateSystem <UpdateCharPresentationState>(m_world);
        m_ApplyPresentationState      = m_world.GetECSWorld().CreateSystem <ApplyPresentationState>(m_world);
        m_characterCameraSystem       = m_world.GetECSWorld().CreateSystem <UpdateCharacterCamera>(m_world);

        m_UpdatePresentationRootTransform = m_world.GetECSWorld().CreateSystem <UpdatePresentationRootTransform>(m_world);

        Console.AddCommand("thirdperson", CmdToggleThirdperson, "Toggle third person mode", this.GetHashCode());
    }
Пример #6
0
    public bool Init(string[] args)
    {
        m_StateMachine = new StateMachine <PreviewState>();
        m_StateMachine.Add(PreviewState.Loading, null, UpdateLoadingState, null);
        m_StateMachine.Add(PreviewState.Active, EnterActiveState, UpdateStateActive, LeaveActiveState);

        Console.AddCommand("nextchar", CmdNextHero, "Select next character", GetHashCode());
        Console.AddCommand("nextteam", CmdNextTeam, "Select next character", GetHashCode());
        Console.AddCommand("spectator", CmdSpectatorCam, "Select spectator cam", GetHashCode());
        Console.AddCommand("respawn", CmdRespawn, "Force a respawn. Optional argument defines now many seconds untill respawn", this.GetHashCode());

        Console.SetOpen(false);

        m_GameWorld = new GameWorld("World[PreviewGameLoop]");

        if (args.Length > 0)
        {
            Game.game.levelManager.LoadLevel(args[0]);
            m_StateMachine.SwitchTo(PreviewState.Loading);
        }
        else
        {
            m_StateMachine.SwitchTo(PreviewState.Active);
        }

        GameDebug.Log("Preview initialized");
        return(true);
    }
Пример #7
0
 //添加控制台快捷显示
 public static void addGmGMCommand(string command, eGmCommandType type, string helpInfo = "")
 {
     if (!mGms.ContainsKey(command))
     {
         mGms.Add(command, type);
         Console.AddCommand(command, Unuse, helpInfo);
     }
 }
Пример #8
0
    public CharacterModulePreview(GameWorld world, BundledResourceManager resourceSystem) : base(world)
    {
        // Handle spawn requests
        m_HandleCharacterSpawnRequests  = m_world.GetECSWorld().CreateManager <HandleCharacterSpawnRequests>(m_world, resourceSystem, false);
        m_HandleCharacterDepawnRequests = m_world.GetECSWorld().CreateManager <HandleCharacterDespawnRequests>(m_world);

        // Handle control change
        m_ControlledEntityChangedSystems.Add(m_world.GetECSWorld().CreateManager <PlayerCharacterControlSystem>(m_world));
        m_ControlledEntityChangedSystems.Add(m_world.GetECSWorld().CreateManager <UpdateCharacter1PSpawn>(m_world, resourceSystem));

        // Handle spawning
        CharacterBehaviours.CreateHandleSpawnSystems(m_world, m_HandleSpawnSystems, resourceSystem, false);

        // Handle despawn
        CharacterBehaviours.CreateHandleDespawnSystems(m_world, m_HandleDespawnSystems);

        // Movement
        m_MovementStartSystems.Add(m_world.GetECSWorld().CreateManager <UpdateTeleportation>(m_world));
        CharacterBehaviours.CreateMovementStartSystems(m_world, m_MovementStartSystems);
        CharacterBehaviours.CreateMovementResolveSystems(m_world, m_MovementResolveSystems);

        // Ability
        CharacterBehaviours.CreateAbilityStartSystems(m_world, m_AbilityStartSystems);
        CharacterBehaviours.CreateAbilityResolveSystems(m_world, m_AbilityResolveSystems);

        m_UpdateCharPresentationState = m_world.GetECSWorld().CreateManager <UpdateCharPresentationState>(m_world);
        m_ApplyPresentationState      = m_world.GetECSWorld().CreateManager <ApplyPresentationState>(m_world);

        m_CharacterLateUpdate = m_world.GetECSWorld().CreateManager <CharacterLateUpdate>(m_world);

        m_HandleDamage = m_world.GetECSWorld().CreateManager <HandleDamage>(m_world);

        m_updateCharacterUI     = m_world.GetECSWorld().CreateManager <UpdateCharacterUI>(m_world);
        m_characterCameraSystem = m_world.GetECSWorld().CreateManager <UpdateCharacterCamera>(m_world);

        m_UpdatePresentationRootTransform       = m_world.GetECSWorld().CreateManager <UpdatePresentationRootTransform>(m_world);
        m_UpdatePresentationAttachmentTransform = m_world.GetECSWorld().CreateManager <UpdatePresentationAttachmentTransform>(m_world);

        m_HandleCharacterEvents = m_world.GetECSWorld().CreateManager <HandleCharacterEvents>();

        // Preload all character resources (until we have better streaming solution)
        var charRegistry = resourceSystem.GetResourceRegistry <CharacterTypeRegistry>();

        for (var i = 0; i < charRegistry.entries.Count; i++)
        {
            resourceSystem.LoadSingleAssetResource(charRegistry.entries[i].prefab1P.guid);
            resourceSystem.LoadSingleAssetResource(charRegistry.entries[i].prefabClient.guid);
        }
        var itemRegistry = resourceSystem.GetResourceRegistry <ItemRegistry>();

        for (var i = 0; i < itemRegistry.entries.Count; i++)
        {
            resourceSystem.LoadSingleAssetResource(itemRegistry.entries[i].prefab1P.guid);
            resourceSystem.LoadSingleAssetResource(itemRegistry.entries[i].prefabClient.guid);
        }

        Console.AddCommand("thirdperson", CmdToggleThirdperson, "Toggle third person mode", this.GetHashCode());
    }
Пример #9
0
 public override void _Ready()
 {
     _wrapper = GetTree().Root.GetNode <Console>("CSharpConsole");
     _wrapper.AddCommand("change_csharp_label", this, nameof(ChangeLabelText))
     .SetDescription("Changes label to %newText%")
     .AddArgument("newText", Variant.Type.String)
     .Register();
     _label = GetNode <Label>("Label");
 }
Пример #10
0
 public static void regeditGMCommand()
 {
     Table.ForeachGMCommand(table =>
     {
         addGmGMCommand("!!" + table.Command, (eGmCommandType)table.Type);
         return(true);
     });
     Console.AddCommand("@@Moveto", MoveTo, "");
 }
Пример #11
0
    //Commands
    //=======================================================
    private void RegisterConsoleCommands()
    {
        Console.AddCommand("serve", CmdServe, "Start server listening", this.GetHashCode());
        Console.AddCommand("client", CmdClient, "client: Enter client mode.", this.GetHashCode());
        Console.AddCommand("preview", CmdPreview, "Start preview mode");
        Console.AddCommand("boot", CmdBoot, "Go back to boot loop", this.GetHashCode());

        Console.AddCommand("quit", CmdQuit, "Quits", this.GetHashCode());
    }
Пример #12
0
 void Start()
 {
     Console.AddCommand(new Command <string>("TIME_TIMESCALE", TimeScale));
     Console.AddCommand(new Command <string>("TIME_SHOWTIME", ShowTime));
     Console.AddCommand(new Command <string>("PHYSICS_GRAVITY_X", XGravity));
     Console.AddCommand(new Command <string>("PHYSICS_GRAVITY_Y", YGravity));
     Console.AddCommand(new Command <string>("PHYSICS_GRAVITY_Z", ZGravity));
     Console.AddCommand(new Command <string>("EXAMPLE_HELP", ExampleCommand, ExampleCommandHelp));
 }
Пример #13
0
 // Use this for initialization
 void Start()
 {
     Console.AddCommand("crab", "", this, null);
     Console.AddCommand("crusty", "", this, null);
     Console.AddCommand("credentials", "", this, null);
     Console.AddCommand("credentialisation", "", this, null);
     Console.AddCommand("credentialisationed", "", this, null);
     Console.AddCommand("credulity", "", this, null);
 }
Пример #14
0
    public void Start()
    {
        Console.AddCommand("addItem", CmdAdd, "Add item to your inventory", CmdAddAutocomplete);

        ResourceType[] resources = Resources.LoadAll <ResourceType>("ResourceItems");
        foreach (ResourceType r in resources)
        {
            items.Add(r.name.ToLower(), r);
        }
    }
Пример #15
0
 protected override void Initialize()
 {
     base.Initialize();
     HasConsole = true;
     ConsoleKey = Keys.OemTilde;
     Graphics.ApplyChanges();
     Window.Title      = "NeatStarter";
     DefaultTransition = new Neat.Transitions.Fader();
     Console.AddCommand("greet", greet_func);
 }
Пример #16
0
    public bool Init(string[] args)
    {
        m_StateMachine = new StateMachine <ClientState>();
        m_StateMachine.Add(ClientState.Browsing, EnterBrowsingState, UpdateBrowsingState, LeaveBrowsingState);
        m_StateMachine.Add(ClientState.Connecting, EnterConnectingState, UpdateConnectingState, null);
        m_StateMachine.Add(ClientState.Loading, EnterLoadingState, UpdateLoadingState, null);
        m_StateMachine.Add(ClientState.Playing, EnterPlayingState, UpdatePlayingState, LeavePlayingState);

#if UNITY_EDITOR
        Game.game.levelManager.UnloadLevel();
        World.DisposeAllWorlds();
#endif
        m_GameWorld = new GameWorld("ClientWorld");

        m_NetworkTransport = new SocketTransport();
        m_NetworkClient    = new NetworkClient(m_NetworkTransport);

        if (Application.isEditor || Game.game.buildId == "AutoBuild")
        {
            NetworkClient.clientVerifyProtocol.Value = "0";
        }

        m_NetworkClient.UpdateClientConfig();
        m_NetworkStatistics = new NetworkStatisticsClient(m_NetworkClient);
        m_ChatSystem        = new ChatSystemClient(m_NetworkClient);

        GameDebug.Log("Network client initialized");

        m_requestedPlayerSettings.playerName = clientPlayerName.Value;
        m_requestedPlayerSettings.teamId     = -1;

        Console.AddCommand("disconnect", CmdDisconnect, "Disconnect from server if connected", this.GetHashCode());
        Console.AddCommand("prediction", CmdTogglePrediction, "Toggle prediction", this.GetHashCode());
        Console.AddCommand("runatserver", CmdRunAtServer, "Run command at server", this.GetHashCode());
        Console.AddCommand("respawn", CmdRespawn, "Force a respawn", this.GetHashCode());
        Console.AddCommand("nextchar", CmdNextChar, "Select next character", this.GetHashCode());
        Console.AddCommand("nc", CmdNextChar, "short version of nextchar", this.GetHashCode());
        Console.AddCommand("nextteam", CmdNextTeam, "Select next team", this.GetHashCode());
        Console.AddCommand("spectator", CmdSpectator, "Select spectator cam", this.GetHashCode());
        Console.AddCommand("matchmake", CmdMatchmake, "matchmake <hostname[:port]/{projectid}>: Find and join a server", this.GetHashCode());

        if (args.Length > 0)
        {
            targetServer = args[0];
            m_StateMachine.SwitchTo(ClientState.Connecting);
        }
        else
        {
            m_StateMachine.SwitchTo(ClientState.Browsing);
        }

        GameDebug.Log("Client initialized");

        return(true);
    }
Пример #17
0
    public static void Init()
    {
        Console.AddCommand("r_resolution", CmdResolution, "Display or set resolution, e.g. 1280x720");
        Console.AddCommand("r_quality", CmdQuality, "Set the render quality");
        Console.AddCommand("r_maxqueue", CmdMaxQueue, "Max queued frames");
        Console.AddCommand("r_srpbatching", CmdSrpBatching, "Use 0 or 1 to disable or enable SRP batching");

        if (rResolution.Value == "")
        {
            rResolution.Value = Screen.currentResolution.width + "x" + Screen.currentResolution.height + "@" + Screen.currentResolution.refreshRate;
        }
    }
Пример #18
0
 private bool RegisterMacro(Macro macro)
 {
     if (!CanUseName(macro.Name))
     {
         return(false);
     }
     m_Macros.Add(macro);
     Console.RemoveCommand(macro.Name);
     Console.AddCommand(new MacroPlayerCommand(Console, macro));
     NameHint.InvalidateCache();
     return(true);
 }
Пример #19
0
    public bool Init(string[] args)
    {
        NetworkClient.m_DropSnapshots = true;

#if UNITY_EDITOR
        Game.game.levelManager.UnloadLevel();
#endif
        Console.AddCommand("disconnect", CmdDisconnect, "Disconnect from server if connected", this.GetHashCode());

        GameDebug.Log("ThinClient initialized");

        return(true);
    }
Пример #20
0
    public GameStatistics()
    {
        m_FrequencyMS = System.Diagnostics.Stopwatch.Frequency / 1000;
        m_StopWatch   = new System.Diagnostics.Stopwatch();
        m_StopWatch.Start();
        m_LastFrameTicks = m_StopWatch.ElapsedTicks;

        m_GraphicsDeviceName = SystemInfo.graphicsDeviceName;

        Console.AddCommand("show.profilers", CmdShowProfilers, "Show available profilers.");

        frameTimeData      = Overlay.Managed.instance.m_Unmanaged.m_GraphDataReservations.Reserve(_no_frames);
        ticksPerFrameData0 = Overlay.Managed.instance.m_Unmanaged.m_GraphDataReservations.Reserve(_no_frames);
        ticksPerFrameData1 = Overlay.Managed.instance.m_Unmanaged.m_GraphDataReservations.Reserve(_no_frames);
    }
Пример #21
0
    public ServerCameraSystem()
    {
        m_CameraSpots = Object.FindObjectsOfType <ServerCameraSpot>();

        // NOTE : We should look at this when we have figured out the final
        // way that cameras should work
        GameObject cameraGO = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/ServerCam"));

        m_Camera = cameraGO.GetComponent <Camera>();

        if (m_Camera)
        {
            GameApp.CameraStack.PushCamera(m_Camera);
        }

        Console.AddCommand("debug.servercam_shots", CmdServercamShots, "Grab a screenshot from each of the servercams");
    }
Пример #22
0
        protected override void RegisterConsoleCommands()
        {
            Console.AddCommand("mod_command", "s?i", "Specify command accessibility for moderators", ConfigFlags.Server, ConsoleModCommand);
            Console.AddCommand("mod_status", string.Empty, "List all commands which are accessible for moderators", ConfigFlags.Server, ConsoleModStatus);

            Console.AddCommand("status", string.Empty, "List players", ConfigFlags.Server, ConsoleStatus);
            Console.AddCommand("shutdown", string.Empty, "Shut down", ConfigFlags.Server, ConsoleShutdown);
            Console.AddCommand("logout", string.Empty, "Logout of rcon", ConfigFlags.Server, ConsoleLogout);
            Console.AddCommand("reload", string.Empty, "Reload the map", ConfigFlags.Server, ConsoleReload);

            Console.AddCommand("kick", "i?r", "Kick player with specified id for any reason", ConfigFlags.Server, ConsoleKick);
            Console.AddCommand("record", "?s", "Record to a file", ConfigFlags.Server | ConfigFlags.Store, ConsoleRecord);
            Console.AddCommand("stoprecord", string.Empty, "Stop recording", ConfigFlags.Server, ConsoleStopRecord);

            Console.SetAccessLevel(BaseServerClient.AuthedModerator, "logout");

            GameContext.RegisterConsoleCommands();
        }
Пример #23
0
    public void Init()
    {
        Debug.Assert(_instance == null);
        _instance = this;

        m_DebugOverlay = new DebugOverlay();
        m_DebugOverlay.Init(120, 36);

        m_Console = new Console();
        m_Console.Init();

        m_Console.AddCommand("quit", CmdQuit, "Quit game");

        m_Stats = new Stats();
        m_Stats.Init();

        Game.console.Write("^FFFGame initialized^F44.^4F4.^44F.\n");
    }
Пример #24
0
#pragma warning restore 649

    public static void Init()
    {
        Console.AddCommand("r_resolution", CmdResolution, "Display or set resolution, e.g. 1280x720");
        Console.AddCommand("r_quality", CmdQuality, "Set the render quality");
        Console.AddCommand("r_maxqueue", CmdMaxQueue, "Max queued frames");
        Console.AddCommand("r_srpbatching", CmdSrpBatching, "Use 0 or 1 to disable or enable SRP batching");

        // Default to reasonable window
        if (rResolution.Value == "")
        {
            rResolution.Value = "1280x720@" + Screen.currentResolution.refreshRate;
        }

        currentQualityIdx = default;
        currentResX       = default;
        currentResY       = default;
        currentResRate    = default;
    }
Пример #25
0
    public GameStatistics()
    {
        m_FrequencyMS = System.Diagnostics.Stopwatch.Frequency / 1000;
        m_StopWatch   = new System.Diagnostics.Stopwatch();
        m_StopWatch.Start();
        m_LastFrameTicks = m_StopWatch.ElapsedTicks;
        m_FrameTimes     = new float[_no_frames];
        m_TicksPerFrame  = new float[2][] { new float[_no_frames], new float[_no_frames] };

        m_GraphicsDeviceName = SystemInfo.graphicsDeviceName;

        for (int i = 0; i < recordersList.Length; i++)
        {
            var sampler = Sampler.Get(recordersList[i].name);
            if (sampler != null)
            {
                recordersList[i].recorder = sampler.GetRecorder();
            }
        }

        Console.AddCommand("show.profilers", CmdShowProfilers, "Show available profilers.");
    }
Пример #26
0
    public bool Init()
    {
        NetworkTransport.Init();

        var connectionConfig = new ConnectionConfig();
        var topology         = new HostTopology(connectionConfig, 16);

        // Start listening for broadcasts from servers
        byte error;

        m_BroadcastHostId = NetworkTransport.AddHost(topology, config.port);
        if (m_BroadcastHostId != -1)
        {
            NetworkTransport.SetBroadcastCredentials(m_BroadcastHostId, config.key, config.version, config.subVersion, out error);
            Console.AddCommand("servers", CmdServers, "servers: list known servers on lan", this.GetHashCode());
            return(true);
        }
        else
        {
            GameDebug.Log("ERROR : Could not setup server broadcast listener!");
            return(false);
        }
    }
Пример #27
0
        public override void RegisterConsoleCommands()
        {
            Console.AddCommand("tune", "s?i", "Tune variable to value", ConfigFlags.Server, ConsoleTune);
            Console.AddCommand("tune_reset", string.Empty, "Reset tuning", ConfigFlags.Server, ConsoleTuneReset);
            Console.AddCommand("tune_dump", string.Empty, "Dump tuning", ConfigFlags.Server, ConsoleTuneDump);

            Console.AddCommand("pause", "?i", "Pause/unpause game", ConfigFlags.Server | ConfigFlags.Store, ConsolePause);
            Console.AddCommand("change_map", "r", "Change map", ConfigFlags.Server | ConfigFlags.Store, ConsoleChangeMap);
            Console.AddCommand("restart", "?i", "Restart in x seconds (0 == abort)", ConfigFlags.Server | ConfigFlags.Store, ConsoleRestart);
            Console.AddCommand("say", "r", "Say in chat", ConfigFlags.Server, ConsoleSay);
            Console.AddCommand("broadcast", "r", "Broadcast message", ConfigFlags.Server, ConsoleBroadcast);
            Console.AddCommand("set_team", "ii?i", "Set team of player to team", ConfigFlags.Server, ConsoleSetTeam);
            Console.AddCommand("set_team_all", "i", "Set team of all players to team", ConfigFlags.Server, ConsoleSetTeamAll);
            Console.AddCommand("swap_teams", string.Empty, "Swap the current teams", ConfigFlags.Server, ConsoleSwapTeams);
            Console.AddCommand("shuffle_teams", string.Empty, "Shuffle the current teams", ConfigFlags.Server, ConsoleShuffleTeams);
            Console.AddCommand("lock_teams", string.Empty, "Lock/unlock teams", ConfigFlags.Server, ConsoleLockTeams);
            Console.AddCommand("force_teambalance", string.Empty, "Force team balance", ConfigFlags.Server, ConsoleForceTeamBalance);

            Console.AddCommand("add_vote", "sr", "Add a voting option", ConfigFlags.Server, ConsoleAddVote);
            Console.AddCommand("remove_vote", "s", "Remove a voting option", ConfigFlags.Server, ConsoleRemoveVote);
            Console.AddCommand("clear_votes", string.Empty, "Clears the voting options", ConfigFlags.Server, ConsoleClearVotes);
            Console.AddCommand("vote", "r", "Force a vote to yes/no", ConfigFlags.Server, ConsoleVote);
        }
Пример #28
0
    public bool Init(string[] args)
    {
        m_StateMachine = new StateMachine<PreviewState>();
        m_StateMachine.Add(PreviewState.Loading, null, UpdateLoadingState, null);
        m_StateMachine.Add(PreviewState.Active, EnterActiveState, UpdateStateActive, LeaveActiveState);

        Console.AddCommand("nextchar", CmdNextHero, "Select next character", GetHashCode());
        Console.AddCommand("nextteam", CmdNextTeam, "Select next character", GetHashCode());
        Console.AddCommand("spectator", CmdSpectatorCam, "Select spectator cam", GetHashCode());
        Console.AddCommand("respawn", CmdRespawn, "Force a respawn. Optional argument defines now many seconds untill respawn", this.GetHashCode());
        
        Console.SetOpen(false);

        m_GameWorld = new GameWorld("World[PreviewGameLoop]");
#if UNITY_EDITOR
        // As previewmode will keep current scene open in editor we need make sure GameObjectEntities are registered
        // in our world. This is done rather hackily by calling OnEnable
        foreach (var gameObjectEntity in GameObject.FindObjectsOfType<GameObjectEntity>())
            gameObjectEntity.OnEnable();
#endif       
        
        
        
        if (args.Length > 0)
        {
            Game.game.levelManager.LoadLevel(args[0]);
            m_StateMachine.SwitchTo(PreviewState.Loading);
        }
        else
        {
            m_StateMachine.SwitchTo(PreviewState.Active);
        }

        GameDebug.Log("Preview initialized");
        return true;
    }
Пример #29
0
 public MovableSystemServer(World world)
 {
     m_GameWorld = world;
     Console.AddCommand("spawnbox", CmdSpawnBox, "Spawn <n> boxes", GetHashCode());
     Console.AddCommand("despawnboxes", CmdDespawnBoxes, "Despawn all boxes", GetHashCode());
 }
Пример #30
0
    public void Awake()
    {
        GameDebug.Log("-- Game Awakeing --");

        GameDebug.Assert(game == null);
        //DontDestroyOnLoad(gameObject);
        game = this;

        m_StopwatchFrequency = System.Diagnostics.Stopwatch.Frequency;
        m_Clock = new System.Diagnostics.Stopwatch();
        m_Clock.Start();

        var commandLineArgs = new List <string>(System.Environment.GetCommandLineArgs());

        var consoleRestoreFocus = commandLineArgs.Contains("-consolerestorefocus");

        var consoleUI = Instantiate(Resources.Load <ConsoleGUI>("Prefabs/ConsoleGUI"));

        DontDestroyOnLoad(consoleUI);
        Console.Init(consoleUI);

        m_DebugOverlay = Instantiate(Resources.Load <DebugOverlay>("Prefabs/DebugOverlay"));
        DontDestroyOnLoad(m_DebugOverlay);
        m_DebugOverlay.Init();

        // If -logfile was passed, we try to put our own logs next to the engine's logfile
        var engineLogFileLocation = ".";
        var logfileArgIdx         = commandLineArgs.IndexOf("-logfile");

        if (logfileArgIdx >= 0 && commandLineArgs.Count >= logfileArgIdx)
        {
            engineLogFileLocation = System.IO.Path.GetDirectoryName(commandLineArgs[logfileArgIdx + 1]);
        }

        var logName = m_isHeadless ? "game_" + DateTime.UtcNow.ToString("yyyyMMdd_HHmmss_fff") : "game";

        GameDebug.Init(engineLogFileLocation, logName);

        ConfigVar.Init();

#if UNITY_EDITOR
        GameDebug.Log("Build type: editor");
#elif DEVELOPMENT_BUILD
        GameDebug.Log("Build type: development");
#else
        GameDebug.Log("Build type: release");
#endif
        //GameDebug.Log("BuildID: " + buildId);
        GameDebug.Log("Cwd: " + System.IO.Directory.GetCurrentDirectory());


        // Game loops
        Console.AddCommand("zero", CmdZero, "Start preview mode");

        Console.AddCommand("gameloops", CmdGameLoops, "List all current game loops.");
        Console.AddCommand("clear", CmdClear, "Shutdown all initilized IGameLoop provided as argument.");
        Console.AddCommand("reset", CmdResetLoop, "Resets all initilized IGameLoop provided as argument.");

        // Utility commands
        Console.AddCommand("quit", CmdQuit, "Quits");
        Console.AddCommand("screenshot", CmdScreenshot, "Capture screenshot. Optional argument is destination folder or filename.");
        Console.AddCommand("crashme", (string[] args) => { GameDebug.Assert(false); }, "Crashes the game next frame ");

#if UNITY_STANDALONE_WIN
        Console.AddCommand("windowpos", CmdWindowPosition, "Position of window. e.g. windowpos 100,100");
#endif

        Console.SetOpen(true);
        Console.ProcessCommandLineArguments(commandLineArgs.ToArray());

        if (k_BootConfigFilename != null)
        {
            Console.EnqueueCommandNoHistory("exec -s " + k_BootConfigFilename);
        }

        GameDebug.Log("-- Game Awake --");
    }