예제 #1
0
    public void Start()
    {
        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        m_widgetEventDispatcher = new WidgetEventDispatcher();
        m_widgetEventDispatcher.Start(m_rootWidgetGroup);

        // Create the background
        m_backgroundGroup       = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);
        m_backgroundTiles       = null;
        m_wallTiles             = null;
        m_backgroundObjectTiles = null;

        // Create the foreground object group
        m_entityGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);

        // Create the foreground tile group
        m_foregroundGroup       = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);
        m_foregroundObjectTiles = null;

        // Create the foreground UI
        m_foregroundUIGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);

        // Create game button
        m_logoutButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, 0, 0, "Logout");

        // Create the event navigation buttons
        {
            float layoutX = 0;
            float layoutY = Screen.height - buttonStyle.Height;

            m_firstEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<<");

            layoutX += m_firstEventButton.Width;
            m_previousEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<");

            layoutX += m_previousEventButton.Width;
            m_playPauseEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "||");

            layoutX          += m_playPauseEventButton.Width;
            m_nextEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">");

            layoutX          += m_nextEventButton.Width;
            m_lastEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">>");
        }
    }
예제 #2
0
    private void UpdateCurrentNavRef()
    {
        SessionData sessionData = SessionData.GetInstance();
        GameData    gameData    = sessionData.CurrentGameData;
        RoomData    roomData    = gameData.GetCachedRoomData(gameData.CurrentRoomKey);

        if (roomData != null)
        {
            AsyncRPGSharedLib.Navigation.NavMesh navMesh = roomData.StaticRoomData.NavMesh;

            Point2d pixelPoint = WidgetEventDispatcher.GetMousePosition();
            Point3d roomPoint  = GameConstants.ConvertPixelPositionToRoomPosition(pixelPoint);

            m_currentNavRef = navMesh.ComputeNavRefAtPoint(roomPoint);
        }
    }
예제 #3
0
    public void Start()
    {
        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        m_widgetEventDispatcher = new WidgetEventDispatcher();
        m_widgetEventDispatcher.Start(m_rootWidgetGroup);

        // Create the background
        m_backgroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);
        m_backgroundTiles = null;
        m_wallTiles = null;
        m_backgroundObjectTiles = null;

        // Create the foreground object group
        m_entityGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);

        // Create the foreground tile group
        m_foregroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);
        m_foregroundObjectTiles = null;

        // Create the foreground UI
        m_foregroundUIGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f);

        // Create game button
        m_logoutButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, 0, 0, "Logout");

        // Create the event navigation buttons
        {
            float layoutX = 0;
            float layoutY = Screen.height - buttonStyle.Height;

            m_firstEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<<");

            layoutX += m_firstEventButton.Width;
            m_previousEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<");

            layoutX += m_previousEventButton.Width;
            m_playPauseEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "||");

            layoutX += m_playPauseEventButton.Width;
            m_nextEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">");

            layoutX += m_nextEventButton.Width;
            m_lastEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">>");
        }
    }
예제 #4
0
    public void Start()
    {
        bool isLocalServerRunning = AsyncRPGServer.GetInstance().IsServerActive();

        Screen.showCursor = true;

        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        m_widgetEventDispatcher = new WidgetEventDispatcher();
        m_widgetEventDispatcher.Start(m_rootWidgetGroup);

        // Create the widget group to hold the login panel
        m_loginPanelWidgetGroup =
            new WidgetGroup(
                m_rootWidgetGroup,
                loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height,
                Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2,
                Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2);

        // Background for the game info
        new ImageWidget(
            m_loginPanelWidgetGroup,
            loginPanelStyle.gamePanelStyle.Width,
            loginPanelStyle.gamePanelStyle.Height,
            loginPanelStyle.gamePanelStyle.Background,
            0.0f, 0.0f);

        // Username and Password - Left Aligned
        {
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing,
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing);
            cursor.Kerning = loginPanelStyle.gamePanelStyle.WidgetSpacing;
            cursor.Leading = loginPanelStyle.gamePanelStyle.WidgetSpacing;

            // Server
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Server:"));
            m_serverText =
                cursor.Advance(
                    new TextEntryWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.textEntryStyle,
                        cursor.X, cursor.Y,
                        "localhost"));
            m_serverText.Visible = !isLocalServerRunning;
            m_localHostLabel     =
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    m_serverText.Width, m_serverText.Height,
                    m_serverText.LocalX, m_serverText.LocalY,
                    "localhost");
            m_localHostLabel.Visible = isLocalServerRunning;
            cursor.NewLine();

            // Local hosted check box
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Host Server:"));
            m_localHostCheckBox =
                cursor.Advance(
                    new CheckBoxWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.checkBoxStyle,
                        cursor.X, cursor.Y));
            m_localHostCheckBox.Enabled = isLocalServerRunning;
            cursor.NewLine();

            // Username
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Username:"******"test" : ""));
            cursor.NewLine();

            // Password
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Password:"******"password" : ""));
            m_passwordText.IsPassword = true;
            cursor.NewLine();
        }

        // Buttons - Centered along the bottom
        {
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                loginPanelStyle.gamePanelStyle.Width / 2
                - loginPanelStyle.gamePanelStyle.WidgetSpacing / 2
                - loginPanelStyle.buttonStyle.Width,
                loginPanelStyle.gamePanelStyle.Height
                - loginPanelStyle.buttonStyle.Height
                - loginPanelStyle.labelStyle.Height
                - loginPanelStyle.gamePanelStyle.BorderWidth
                - loginPanelStyle.gamePanelStyle.WidgetSpacing);

            m_createAccountButton =
                cursor.Advance(
                    new ButtonWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.buttonStyle,
                        cursor.X, cursor.Y,
                        "New Account"));
            m_createAccountButton.Visible = false;

            m_loginButton =
                cursor.Advance(
                    new ButtonWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.buttonStyle,
                        cursor.X, cursor.Y,
                        "Login"));
            m_loginButton.Visible = true;

            cursor.NewLine();

            m_loginStatusLabel =
                cursor.Advance(
                    new LabelWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.gamePanelStyle.Width
                        - 2.0f * loginPanelStyle.gamePanelStyle.BorderWidth,
                        loginPanelStyle.labelStyle.Height,
                        cursor.X, cursor.Y,
                        ""));
        }

        // Server Status Panel
        m_serverPanelWidgetGroup =
            new WidgetGroup(
                m_rootWidgetGroup,
                loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height,
                Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2,
                Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2);
        m_serverPanelWidgetGroup.Visible = false;

        // Background for the game info
        new ImageWidget(
            m_serverPanelWidgetGroup,
            loginPanelStyle.gamePanelStyle.Width,
            loginPanelStyle.gamePanelStyle.Height,
            loginPanelStyle.gamePanelStyle.Background,
            0.0f, 0.0f);

        {
            float contentCenter       = loginPanelStyle.gamePanelStyle.Width / 2.0f;
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                0.0f,
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing);
            cursor.Kerning = loginPanelStyle.gamePanelStyle.WidgetSpacing;
            cursor.Leading = loginPanelStyle.gamePanelStyle.WidgetSpacing;

            LabelWidget topLabel =
                cursor.Advance(
                    new LabelWidget(
                        m_serverPanelWidgetGroup,
                        loginPanelStyle.labelStyle,
                        contentCenter - loginPanelStyle.labelStyle.Width / 2.0f, cursor.Y,
                        "[Server]"));
            topLabel.Alignment = TextAnchor.UpperCenter;
            cursor.NewLine();

            m_serverStatusText =
                cursor.Advance(
                    new ScrollTextWidget(
                        m_serverPanelWidgetGroup,
                        loginPanelStyle.scrollTextStyle,
                        contentCenter - loginPanelStyle.scrollTextStyle.Width / 2.0f, cursor.Y,
                        ""));
            cursor.NewLine();

            m_serverOkButton =
                cursor.Advance(
                    new ButtonWidget(
                        m_serverPanelWidgetGroup,
                        loginPanelStyle.buttonStyle,
                        contentCenter - loginPanelStyle.buttonStyle.Width / 2.0f, cursor.Y,
                        "Ok"));
            m_serverOkButton.Visible = false;
        }
    }
예제 #5
0
    public void Start()
    {
        bool isLocalServerRunning= AsyncRPGServer.GetInstance().IsServerActive();
        Screen.showCursor = true;

        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        m_widgetEventDispatcher = new WidgetEventDispatcher();
        m_widgetEventDispatcher.Start(m_rootWidgetGroup);

        // Create the widget group to hold the login panel
        m_loginPanelWidgetGroup =
            new WidgetGroup(
                m_rootWidgetGroup,
                loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height,
                Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2,
                Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2);

        // Background for the game info
        new ImageWidget(
            m_loginPanelWidgetGroup,
            loginPanelStyle.gamePanelStyle.Width,
            loginPanelStyle.gamePanelStyle.Height,
            loginPanelStyle.gamePanelStyle.Background,
            0.0f, 0.0f);

        // Username and Password - Left Aligned
        {
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing,
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing);
            cursor.Kerning= loginPanelStyle.gamePanelStyle.WidgetSpacing;
            cursor.Leading= loginPanelStyle.gamePanelStyle.WidgetSpacing;

            // Server
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Server:"));
            m_serverText =
                cursor.Advance(
                    new TextEntryWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.textEntryStyle,
                        cursor.X, cursor.Y,
                        "localhost"));
            m_serverText.Visible= !isLocalServerRunning;
            m_localHostLabel=
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    m_serverText.Width, m_serverText.Height,
                    m_serverText.LocalX, m_serverText.LocalY,
                    "localhost");
            m_localHostLabel.Visible= isLocalServerRunning;
            cursor.NewLine();

            // Local hosted check box
            cursor.Advance(
                new LabelWidget(
                m_loginPanelWidgetGroup,
                loginPanelStyle.labelStyle,
                cursor.X, cursor.Y,
                "Host Server:"));
            m_localHostCheckBox=
                cursor.Advance(
                    new CheckBoxWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.checkBoxStyle,
                        cursor.X, cursor.Y));
            m_localHostCheckBox.Enabled = isLocalServerRunning;
            cursor.NewLine();

            // Username
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Username:"******"test" : ""));
            cursor.NewLine();

            // Password
            cursor.Advance(
                new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.labelStyle,
                    cursor.X, cursor.Y,
                    "Password:"******"password" : ""));
            m_passwordText.IsPassword= true;
            cursor.NewLine();
        }

        // Buttons - Centered along the bottom
        {
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                loginPanelStyle.gamePanelStyle.Width/2
                - loginPanelStyle.gamePanelStyle.WidgetSpacing/2
                - loginPanelStyle.buttonStyle.Width,
                loginPanelStyle.gamePanelStyle.Height
                - loginPanelStyle.buttonStyle.Height
                - loginPanelStyle.labelStyle.Height
                - loginPanelStyle.gamePanelStyle.BorderWidth
                - loginPanelStyle.gamePanelStyle.WidgetSpacing);

            m_createAccountButton =
                cursor.Advance(
                    new ButtonWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.buttonStyle,
                        cursor.X, cursor.Y,
                        "New Account"));
            m_createAccountButton.Visible= false;

            m_loginButton =
                cursor.Advance(
                    new ButtonWidget(
                        m_loginPanelWidgetGroup,
                        loginPanelStyle.buttonStyle,
                        cursor.X, cursor.Y,
                        "Login"));
            m_loginButton.Visible= true;

            cursor.NewLine();

            m_loginStatusLabel=
                cursor.Advance(
                    new LabelWidget(
                    m_loginPanelWidgetGroup,
                    loginPanelStyle.gamePanelStyle.Width
                    - 2.0f*loginPanelStyle.gamePanelStyle.BorderWidth,
                    loginPanelStyle.labelStyle.Height,
                    cursor.X, cursor.Y,
                    ""));
        }

        // Server Status Panel
        m_serverPanelWidgetGroup =
            new WidgetGroup(
                m_rootWidgetGroup,
                loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height,
                Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2,
                Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2);
        m_serverPanelWidgetGroup.Visible= false;

        // Background for the game info
        new ImageWidget(
            m_serverPanelWidgetGroup,
            loginPanelStyle.gamePanelStyle.Width,
            loginPanelStyle.gamePanelStyle.Height,
            loginPanelStyle.gamePanelStyle.Background,
            0.0f, 0.0f);

        {
            float contentCenter= loginPanelStyle.gamePanelStyle.Width / 2.0f;
            WidgetLayoutCursor cursor = new WidgetLayoutCursor(
                0.0f,
                loginPanelStyle.gamePanelStyle.BorderWidth
                + loginPanelStyle.gamePanelStyle.WidgetSpacing);
            cursor.Kerning= loginPanelStyle.gamePanelStyle.WidgetSpacing;
            cursor.Leading= loginPanelStyle.gamePanelStyle.WidgetSpacing;

            LabelWidget topLabel=
                cursor.Advance(
                    new LabelWidget(
                        m_serverPanelWidgetGroup,
                        loginPanelStyle.labelStyle,
                        contentCenter - loginPanelStyle.labelStyle.Width / 2.0f, cursor.Y,
                        "[Server]"));
            topLabel.Alignment= TextAnchor.UpperCenter;
            cursor.NewLine();

            m_serverStatusText=
                cursor.Advance(
                    new ScrollTextWidget(
                    m_serverPanelWidgetGroup,
                    loginPanelStyle.scrollTextStyle,
                    contentCenter - loginPanelStyle.scrollTextStyle.Width / 2.0f, cursor.Y,
                    ""));
            cursor.NewLine();

            m_serverOkButton=
                cursor.Advance(
                    new ButtonWidget(
                    m_serverPanelWidgetGroup,
                    loginPanelStyle.buttonStyle,
                    contentCenter - loginPanelStyle.buttonStyle.Width / 2.0f, cursor.Y,
                    "Ok"));
            m_serverOkButton.Visible= false;
        }
    }