CursorManager.SetCursor C# (CSharp) Method

SetCursor() public method

public SetCursor ( CursorType, type = CursorType.Main ) : void
type CursorType,
return void
    public void SetCursor(CursorType type = CursorType.Main)
    {
        if (!cursorChangePossible)
            return;
        var texture = getTexture(type);
        if (texture)
        {
        HotSpot = new Vector2(texture.width / 2f, texture.height / 2f);
        Cursor.SetCursor(texture, HotSpot, CursorMode);
        }
    }

Usage Example

Example #1
0
        internal static void StartGame(string mapUID, WorldType type)
        {
            // Dispose of the old world before creating a new one.
            if (worldRenderer != null)
            {
                worldRenderer.Dispose();
            }

            Cursor.SetCursor(null);
            BeforeGameStart();

            Map map;

            using (new PerfTimer("PrepareMap"))
                map = ModData.PrepareMap(mapUID);
            using (new PerfTimer("NewWorld"))
                OrderManager.World = new World(ModData, map, OrderManager, type);

            OrderManager.World.GameOver += FinishBenchmark;

            worldRenderer = new WorldRenderer(ModData, OrderManager.World);

            GC.Collect();

            using (new PerfTimer("LoadComplete"))
                OrderManager.World.LoadComplete(worldRenderer);

            // Create a Http server and start listening for incoming connections
            // Handle requests
            if (OrderManager.World.LocalPlayer != null && HttpServer.Listener == null)
            {
                HttpServer.Listener = new HttpListener();
                HttpServer.Listener.Prefixes.Add(HttpServer.Url);
                HttpServer.Listener.Start();
                Console.WriteLine("Listening for connections on {0}", HttpServer.Url);
                HttpServer.HandleIncomingConnections();
            }

            GC.Collect();

            if (OrderManager.GameStarted)
            {
                return;
            }

            Ui.MouseFocusWidget    = null;
            Ui.KeyboardFocusWidget = null;

            OrderManager.LocalFrameNumber = 0;
            OrderManager.LastTickTime     = RunTime;
            OrderManager.StartGame();
            worldRenderer.RefreshPalette();
            Cursor.SetCursor("default");

            GC.Collect();
        }
All Usage Examples Of CursorManager::SetCursor