RegisterCommand() public static method

public static RegisterCommand ( string commandString, DebugCommand commandCallback, string CMD_Discribes ) : void
commandString string
commandCallback DebugCommand
CMD_Discribes string
return void
 public void hInit()
 {
     if ((m_Command != null) && (m_FunctionName != null))
     {
         DebugConsole.RegisterCommand(m_Command, hRun);
     }
 }
Beispiel #2
0
    void Awake()
    {
        for (int i = 0; i <= 5; i++)
        {
            // Registration Log.
            Debug.Log(10 % 2.1153f);
            UnityEngine.Debug.Log("1111111111");

            Debug.Log("suifeng", Color.cyan);
            Debug.Log("1238908", "test", Color.red);
            Debug.Log("1238908", "ljn", Color.red);
            //Debug.Log(colorToHex(Color.red));
            Debug.Log("PowerupCount " + PowerupCount);

            // Registration Group Log.
            Debug.Log("Test 1324567980123456789", "LogTest1");
            Debug.Log("test", "LogTest2");
            Debug.Log("PowerupCount " + PowerupCount, "LogTest2");

            // Registration LogWarning.
            Debug.LogWarning("test", "LogTest3");

            // Registration LogError.
            Debug.LogError("Hello ", "LogTest4");
        }
        // Watcher in the window register value of the variable.
        Debug.Watcher("PowerupCount", PowerupCount);

        // ShowFunc Command Register.
        DebugConsole.RegisterCommand("ShowFunc", ShowFuncCommand);
    }
Beispiel #3
0
    // logic //

    public override void _Ready()
    {
        if (Engine.EditorHint)
        {
            return;
        }
        base._Ready();

        dynamicCameraSingleton = (DynamicCameraSingleton)GetNode("/root/DynamicCameraSingleton");
        consoleSingleton       = GetNode <DebugConsole>("/root/DebugConsole");
        animatedSprite         = GetNode <AnimatedSprite>("CharacterSprite");
        attackArea             = GetNode <Area2D>("AttackArea");
        swordSlashAnimation    = GetNode <AnimatedSprite>("AttackArea/SwordSlashAnimation");
        globalState            = GetNode <GlobalState>("/root/GlobalState");


        animatedSprite.Play("idle");


        health = maxHealth;

        Node possibleInGameUi = GetNode(inGameUiPath);

        if (possibleInGameUi is InGameUi)
        {
            inGameUi = (InGameUi)possibleInGameUi;
        }

        meleeCooldownProgress = meleeCooldown;

        consoleSingleton.RegisterCommand("godmode", "Disable all player damage", OnGodmode);
    }
Beispiel #4
0
        private void RegisterDebugCommands()
        {
            DelegateCommand command = new DelegateCommand(ListUITemplates, true);

            command.HelpText  = "Lists all currently loaded UI templates from the Colossal UITemplateManager.";
            command.UsageText = "list-ui-templates [filter]";

            DebugConsole.RegisterCommand("list-ui-templates", command);
        }
Beispiel #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            graphics.PreferredBackBufferWidth  = 800;
            graphics.PreferredBackBufferHeight = 600;
            RasterizerState customState = new RasterizerState();

            graphics.GraphicsDevice.RasterizerState = customState;

            graphics.ApplyChanges();

            ComponentRecord.RegisterAttribute <Sprite>("Sprite");
            ComponentRecord.RegisterAttribute <AnimatedSprite>("AnimatedSprite");
            ComponentRecord.RegisterAttribute <Transform>("Transform");
            ComponentRecord.RegisterAttribute <GUIButton>("GUIButton");
            ComponentRecord.RegisterAttribute <GUILabel>("GUILabel");
            ComponentRecord.RegisterAttribute <GUITextBox>("GUITextBox");
            ComponentRecord.RegisterAttribute <GUIImage>("GUIImage");
            ComponentRecord.RegisterAttribute <AABBCollider>("AABBCollider");
            ComponentRecord.RegisterAttribute <SATCollider>("SATCollider");
            ComponentRecord.RegisterAttribute <CharacterController>("CharacterController");

            Debug.InitializeDebug(GraphicsDevice, this);
            DebugConsole.DebugConsoleInit(this, graphics);
            GameSerializer.Init(this);
            GameScript.InitGameScript();
            Transform.UpdateGraphicsSize(graphics);
            InputManager.InitInputManager(this);
            Camera.InitCamera(graphics);
            GUILabel.Initialize(this);

            Exiting += new EventHandler <EventArgs>((object obj, EventArgs args) =>
            {
                Debug.CloseDebug();
            });

            DebugConsole.RegisterCommand("reset", (string[] args) =>
            {
                reset();
            });

            w = new World();

            this.IsMouseVisible = true;

            base.Initialize();
        }
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        NetManager.Init();

        // Set up our console
        DebugConsole.IsOpen = true;
        DebugConsole.RegisterCommand("server.start", ConsoleServerStart);
        DebugConsole.RegisterCommand("client.connect", ConsoleClientConnect);
        DebugConsole.RegisterCommand("client.disconnect", ConsoleClientDisconnect);
        DebugConsole.RegisterCommand("client.send", ConsoleClientSend);
        DebugConsole.RegisterCommand("server.send", ConsoleServerSend);
        DebugConsole.RegisterCommand("server.getclients", ConsoleServerGetClients);
        DebugConsole.RegisterCommand("server.broadcast", ConsoleServerBroadcast);
        DebugConsole.RegisterCommand("server.disconnect", ConsoleServerDisconnect);
        DebugConsole.RegisterCommand("network.test", FullLocalTest);
    }
Beispiel #7
0
        private void probingCode()
        {
            //Temporary - give us a spawner command, to test with
            //DebugConsole.RegisterCommand("/spawn", new DebugConsole.DebugCommand(this.spawner_callback));

            DebugConsole.RegisterCommand("/fire", new DebugConsole.DebugCommand(this.fire_callback));

            DebugConsole.RegisterCommand("/target", new DebugConsole.DebugCommand(this.gettarget_callback));
            try
            {
                //Entity ent = Entity.GetEntityByName("candle_lit");
                //ent.prefab.AddComponent<HookFlickerComp>();
            }
            catch (Exception)
            { }

            DebugOutput(GameObject.FindObjectsOfType <Camera>().Length.ToString());

            foreach (Camera c in GameObject.FindObjectsOfType <Camera>())
            {
                DebugOutput(c.name);
                //c.renderingPath = RenderingPath.DeferredLighting;
            }


            //"mixed_category"

            foreach (Category sub in CategoryReader.categories.Values)
            //foreach(SubCategory sub in CategoryReader.categories["town_biome"].subcats.Values)
            {
                //DebugConsole.Log(sub.name);
            }

            //Camera cam = GameObject.FindObjectOfType<Camera>();
            //cam.renderingPath = RenderingPath.DeferredLighting;


            //Adding our own bikes and such
            //...Promising...
            string n = Entity.GetEntityByName("bicycle_mountainbike").prefab.GetComponent <TDLTwoWheelVehicleMotor>().frontWheelNode.GetComponent <Transform>().position.ToString();

            DebugConsole.Log(n);

            //Entity.GetEntityByName("bicycle_mountainbike").prefab.GetComponent<TDLTwoWheelVehicleMotor>().frontWheelNode.GetComponent<Transform>().position = new Vector3(0f, 1.0f, 0.6f);

            string compList = "";

            //foreach (Component c in Entity.GetEntityByName("bicycle_mountainbike").prefab.GetComponent<TDLTwoWheelVehicleMotor>().frontWheelNode.GetComponents<Component>())
            //foreach (GameObject c in Entity.GetEntityByName("item_wood_campfire_large").prefab.GetComponent<WoodFireControl>().fireParticleObjects)
            foreach (Component c in Entity.GetEntityByName("candle_unlit").prefab.GetComponents <Component>())
            {
                compList += c.GetType().ToString() + "\n";
            }
            File.WriteAllText(@"D:\TDLOut.txt", compList);

            //Dammit. They are using unity lod groups

            foreach (LODGroup c in Entity.GetEntityByName("house_suburban_1story_plain").prefab.GetComponents <LODGroup>())
            {
                DebugConsole.Log("LODs: " + c.lodCount.ToString());
            }


            /*
             * Rigidbody rb = Entity.GetEntityByName("zombie_medium").prefab.AddComponent<Rigidbody>();
             * CapsuleCollider bc = Entity.GetEntityByName("zombie_medium").prefab.AddComponent<CapsuleCollider>();
             * rb.mass = 90.0f;
             * rb.drag = 0f;
             * rb.angularDrag = 0.5f;
             * bc.center = new Vector3(0f, 0f, 0f);
             * //bc.size = new Vector3(0.3f, 1.8f, 0.3f);
             * bc.radius = 0.3f;
             * bc.height = 1.8f;
             */

            //new LineRenderer().

            DebugOutput("Probe Finished");
        }
Beispiel #8
0
        public override int Execute(ICommandContext ctx, string[] args, char[] flags)
        {
            if (!this.VerifyArgsCount(args, 2, Int16.MaxValue))
            {
                this.PrintUsage(ctx);
                return(1);
            }

            IList <string> argsList = args.ToList();

            string alias = argsList[0];

            argsList.RemoveAt(0);

            if (argsList[0].ToLower().Equals("alias"))
            {
                throw new ArgumentException("Cannot register an alias for the alias command.", "args");
            }

            if (this.aliasCommands.Contains(argsList[0].ToLower()))
            {
                throw new ArgumentException("Cannot register an alias for another alias command.", "args");
            }

            if (argsList[0].ToLower().Equals("0"))
            {
                DebugConsole.UnregisterCommand(alias);
                this.aliasCommands.Remove(alias);

                ctx.SendOutput(String.Format("Removed alias {0}", alias));

                return(0);
            }

            string target = String.Join(" ", argsList.ToArray());

            if (flags.Length > 0)
            {
                target += " -" + String.Join(" -", flags.Select(f => f.ToString()).ToArray <string>());
            }

            DelegateCommand delCmd = new DelegateCommand((dCtx, dArgs, dFlags) =>
            {
                target += " " + String.Join(" ", dArgs);

                if (dFlags.Length > 0)
                {
                    target += " -" + String.Join(" -", dFlags.Select(f => f.ToString()).ToArray <string>());
                }

                dCtx.SendOutput(String.Format("Alias {0} executes {1}", alias, target));
                DebugConsole.Execute(target);

                return(0);
            }, true);

            delCmd.UsageText = String.Format("{0} [<AdditionalArg1> <AdditionalArg2> ...]", alias);
            delCmd.HelpText  = String.Format("This is an alias command for {0}\n"
                                             + "You can use this alias to execute the aliased command with default or if required with more arguments.", target);

            DebugConsole.RegisterCommand(alias, delCmd);

            if (!this.aliasCommands.Contains(alias))
            {
                this.aliasCommands.Add(alias);
            }

            ctx.SendOutput(String.Format("Registered command alias {0} for command {1}", alias, target));

            return(0);
        }