当前位置: 首页>>代码示例>>C#>>正文


C# Cursor.GetSprite方法代码示例

本文整理汇总了C#中Cursor.GetSprite方法的典型用法代码示例。如果您正苦于以下问题:C# Cursor.GetSprite方法的具体用法?C# Cursor.GetSprite怎么用?C# Cursor.GetSprite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cursor的用法示例。


在下文中一共展示了Cursor.GetSprite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawRegions

        public void DrawRegions( World world )
        {
            world.WorldRenderer.palette.Update(
                world.WorldActor.traits.WithInterface<IPaletteModifier>());

            float2 r1 = new float2(2, -2) / screenSize;
            float2 r2 = new float2(-1, 1);

            renderer.BeginFrame(r1, r2, scrollPosition.ToInt2());

            if( Game.orderManager.GameStarted )
            {
                world.WorldRenderer.Draw();
                Game.chrome.Draw( world );

                if( Game.orderManager.Connection.ConnectionState == ConnectionState.NotConnected )
                    Game.chrome.DrawDialog("Connection lost.");
            }
            else
            {
                // Still hacky, but at least it uses widgets
                // TODO: Clean up the logic of this beast
                // TODO: Have a proper "In main menu" state
                ConnectionState state = Game.orderManager.Connection.ConnectionState;
                if (state != lastConnectionState)
                {
                    switch( Game.orderManager.Connection.ConnectionState )
                    {
                        case ConnectionState.PreConnecting:
                            Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
                            Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
                            Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
                            break;
                        case ConnectionState.Connecting:
                            Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
                            Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = true;
                            Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;

                            //(Game.chrome.rootWidget.GetWidget("CONNECTION_GROUP_FAILED") as LabelWidget).Text = "Connecting abort";

                            //Game.chrome.DrawDialog("Connecting to {0}:{1}...".F( Game.Settings.NetworkHost, Game.Settings.NetworkPort ));
                            break;
                        case ConnectionState.NotConnected:
                            Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
                            Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
                            Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = true;

                            //(Game.chrome.rootWidget.GetWidget("CONNECTION_GROUP_FAILED") as LabelWidget).Text = "Not Connected Retry/fail";
                            //Game.chrome.DrawDialog("Connection failed.", "Retry", _ => {}, "Cancel",_ => {});
                            break;
                        case ConnectionState.Connected:
                            Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
                            Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
                            Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
                            //Game.chrome.DrawLobby( world );
                            break;
                    }
                }

                // TODO: Kill this (hopefully!) soon
                if (state == ConnectionState.Connected)
                    Game.chrome.DrawLobby( world );

                lastConnectionState = state;
                Game.chrome.DrawWidgets(world);

            }

            var cursorName = Game.chrome.HitTest(mousePos) ? "default" : Game.controller.ChooseCursor( world );
            var c = new Cursor(cursorName);
            cursorRenderer.DrawSprite(c.GetSprite((int)cursorFrame), mousePos + Location - c.GetHotspot(), "cursor");
            cursorRenderer.Flush();

            renderer.EndFrame();
        }
开发者ID:comradpara,项目名称:OpenRA,代码行数:75,代码来源:Viewport.cs


注:本文中的Cursor.GetSprite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。