예제 #1
0
        private void doMenuScreen(Rectangle bounds, SpriteBatch sb)
        {
            var rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height / 3 + 10, bounds.Width / 2, 40);

            if (Button.doButton(101010, rectangle.X + getTransitionOffset(0), rectangle.Y, rectangle.Width,
                                rectangle.Height, "Contract Listing", themeColor))
            {
                state            = HubState.Listing;
                screenTransition = 1f;
            }
            rectangle.Y += rectangle.Height + 5;
            if (Button.doButton(101015, rectangle.X + getTransitionOffset(1), rectangle.Y, rectangle.Width,
                                rectangle.Height, "User List", themeColor))
            {
                state            = HubState.UserList;
                screenTransition = 1f;
            }
            rectangle.Y += rectangle.Height + 5;
            if (
                Button.doButton(101017, rectangle.X + getTransitionOffset(1), rectangle.Y, rectangle.Width,
                                rectangle.Height / 2, "Abort Current Contract", os.currentMission == null ? Color.Black : themeColor) &&
                os.currentMission != null)
            {
                state            = HubState.CancelContract;
                screenTransition = 1f;
            }
            rectangle.Y += rectangle.Height / 2 + 5;
            if (Button.doButton(102015, rectangle.X + getTransitionOffset(3), rectangle.Y, rectangle.Width,
                                rectangle.Height / 2, "Exit", os.lockedColor))
            {
                os.display.command = "connect";
            }
            rectangle.Y += rectangle.Height + 5;
        }
예제 #2
0
        private void doCancelContractScreen(Rectangle bounds, SpriteBatch sb)
        {
            var rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height / 3 + 10, bounds.Width / 2, 40);

            TextItem.doFontLabel(new Vector2(rectangle.X, rectangle.Y),
                                 "Are you sure you with to abandon your current contract?\nThis cannot be reversed.", GuiData.font,
                                 Color.White, bounds.Width - 30, rectangle.Height);
            rectangle.Y += rectangle.Height + 4;
            if (
                Button.doButton(142011, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, "Abandon Contract",
                                Color.Red) && os.currentMission != null)
            {
                os.currentMission = null;
                os.currentFaction.contractAbbandoned(os);
                screenTransition = 0.0f;
                state            = HubState.Menu;
            }
            rectangle.Y += rectangle.Height + 10;
            if (
                !Button.doButton(142015, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, "Back", themeColor))
            {
                return;
            }
            screenTransition = 1f;
            state            = HubState.Menu;
        }
예제 #3
0
    public void Connect()
    {
        if (State != HubState.idle || string.IsNullOrEmpty(m_uri))
        {
            Close();
            return;
        }
        if (IsConnected == true)
        {
            return;
        }

        C2H.HubConnectHeader header = new C2H.HubConnectHeader();
        header.access_token = m_token;
        header.nickname     = Network.PlayerInfo.nickname;
        header.account_idx  = SHSavedData.AccountIdx;

        m_connection = new Connection(new Uri(m_uri), HubName);
        m_connection.AuthenticationProvider = new HeaderAuthentication(header);

        m_connection.OnConnected    += OnConnected;
        m_connection.OnClosed       += OnClosed;
        m_connection.OnError        += OnError;
        m_connection.OnStateChanged += OnStateChange;
        m_connection.Open();


        State = HubState.connecting;
    }
예제 #4
0
    void OnClosed(Connection connection)
    {
        State = HubState.idle;

        Debug.LogFormat("OnClosed : [{0}] [{1}]", hub.Name, connection.State);
        m_disconnected = false;
    }
예제 #5
0
        public State GetState(EnumState type)
        {
            State newState = null;

            switch (type)
            {
            case EnumState.LOGIN:
                newState = new LoginState();
                break;

            case EnumState.CHARACTER_SELECT:
                newState = new CharacterSelectState();
                break;

            case EnumState.CHARACTER_CREATION:
                newState = new CharacterCreationState();
                break;

            case EnumState.HUB:
                newState = new HubState();
                break;

            case EnumState.GAME:

                break;

            case EnumState.TEST:
                newState = new TestState();
                break;
            }

            return(newState);
        }
예제 #6
0
 public override void userLoggedIn()
 {
     base.userLoggedIn();
     activeUserName      = user.name;
     state               = HubState.Menu;
     screenTransition    = 1f;
     activeUserLoginTime = DateTime.Now;
 }
예제 #7
0
    void OnConnected(Connection connection)
    {
        State = HubState.connected;

        hub.On("H2C_SendPacket", OnReceivePacket);

        m_disconnected = true;
    }
예제 #8
0
 public void Close()
 {
     if (m_connection == null)
     {
         return;
     }
     State = HubState.idle;
     m_connection.Close();
 }
예제 #9
0
    public void Start(pe_HubType hub_type, string uri, string group, long token, int channel_count)
    {
        State     = HubState.idle;
        HubType   = hub_type;
        GroupName = group;
        m_uri     = uri;
        HubName   = hub_type.ToString();
        m_token   = token;

        ChannelCount = channel_count;

        Connect();
    }
예제 #10
0
        private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
        {
            var stringForContractFile = getIDStringForContractFile(listingsFolder.files[selectedElementIndex]);

            if (!listingMissions.ContainsKey(stringForContractFile))
            {
                return;
            }
            var mission = listingMissions[stringForContractFile];
            var vector2 = new Vector2(bounds.X + 20, bounds.Y + 20);

            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(0), 0.0f),
                                 "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), bounds.Width / 2, 40f);
            vector2.Y += 40f;
            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(1), 0.0f), mission.postingTitle, GuiData.font,
                                 new Color?(), bounds.Width - 30, float.MaxValue);
            vector2.Y += 30f;
            var text = DisplayModule.cleanSplitForWidth(mission.postingBody, bounds.Width - 110);

            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(2), 0.0f), text, GuiData.smallfont,
                                 new Color?(), bounds.Width - 20, float.MaxValue);
            var num = Math.Max(135, bounds.Height / 6);

            if (Button.doButton(2171618, bounds.X + 20 + getTransitionOffset(3), bounds.Y + bounds.Height - num,
                                bounds.Width / 5, 30, "Back", new Color?()))
            {
                state            = HubState.Listing;
                screenTransition = 1f;
            }
            if (os.currentMission == null)
            {
                if (
                    !Button.doButton(2171615, bounds.X + 20 + getTransitionOffset(4),
                                     bounds.Y + bounds.Height - num - 40, bounds.Width / 5, 30, "Accept", os.highlightColor))
                {
                    return;
                }
                acceptMission(mission, selectedElementIndex, stringForContractFile);
                state            = HubState.Listing;
                screenTransition = 1f;
            }
            else
            {
                TextItem.doFontLabelToSize(
                    new Rectangle(bounds.X + 20 + getTransitionOffset(4), bounds.Y + bounds.Height - num - 40,
                                  bounds.Width / 2, 30), "Abort current contract to accept new ones.", GuiData.smallfont,
                    Color.White);
            }
        }
예제 #11
0
    private void OnStateChange(Connection connection, ConnectionStates oldState, ConnectionStates newState)
    {
        Debug.LogFormat("[{0}] [{1}] => [{2}]", hub.Name, oldState, newState);


        if (oldState == ConnectionStates.Initial && newState == ConnectionStates.Negotiating)
        {
            if (State == HubState.negotiating)
            {
                Close();
                return;
            }
            State = HubState.negotiating;
        }
    }
예제 #12
0
 public override void navigatedTo()
 {
     base.navigatedTo();
     screenTransition      = 1f;
     state                 = HubState.Welcome;
     missionListPageNumber = 0;
     if (thinBarcodeTop != null)
     {
         thinBarcodeTop.regenerate();
     }
     if (thinBarcodeBot == null)
     {
         return;
     }
     thinBarcodeBot.regenerate();
 }
예제 #13
0
        private void drawWelcomeScreen(Rectangle bounds, SpriteBatch sb)
        {
            var rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height / 3 - 10, bounds.Width / 2, 30);
            var text      = (groupName + " Contract Hub").ToUpper();

            TextItem.doFontLabel(new Vector2(rectangle.X, rectangle.Y), text, GuiData.titlefont, new Color?(),
                                 bounds.Width / 0.6f, 50f);
            rectangle.Y += 50;
            if (Button.doButton(11005, rectangle.X + getTransitionOffset(0), rectangle.Y, rectangle.Width,
                                rectangle.Height, "Login", themeColor))
            {
                startLogin();
                state = HubState.Login;
            }
            rectangle.Y += rectangle.Height + 5;
            if (
                !Button.doButton(12010, rectangle.X + getTransitionOffset(1), rectangle.Y, rectangle.Width,
                                 rectangle.Height, "Exit", themeColor))
            {
                return;
            }
            os.display.command = "connect";
        }
예제 #14
0
 private void drawWelcomeScreen(Rectangle bounds, SpriteBatch sb)
 {
     var rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height/3 - 10, bounds.Width/2, 30);
     var text = (groupName + " Contract Hub").ToUpper();
     TextItem.doFontLabel(new Vector2(rectangle.X, rectangle.Y), text, GuiData.titlefont, new Color?(),
         bounds.Width/0.6f, 50f);
     rectangle.Y += 50;
     if (Button.doButton(11005, rectangle.X + getTransitionOffset(0), rectangle.Y, rectangle.Width,
         rectangle.Height, "Login", themeColor))
     {
         startLogin();
         state = HubState.Login;
     }
     rectangle.Y += rectangle.Height + 5;
     if (
         !Button.doButton(12010, rectangle.X + getTransitionOffset(1), rectangle.Y, rectangle.Width,
             rectangle.Height, "Exit", themeColor))
         return;
     os.display.command = "connect";
 }
예제 #15
0
 private void doUserListScreen(Rectangle bounds, SpriteBatch sb)
 {
     if (Button.doButton(101801, bounds.X + 2, bounds.Y + 20, bounds.Width/4, 22, "Back", themeColor))
         state = HubState.Menu;
     var rectangle = new Rectangle(bounds.X + 30, bounds.Y + 50, bounds.Width/2, 30);
     var num1 = 18 + rectangle.Height - 8;
     var num2 = (bounds.Height - 90)/num1;
     var num3 = num2*userListPageNumber;
     var num4 = 0;
     for (var index1 = num2*userListPageNumber;
         index1 < usersFolder.files.Count && index1 < num3 + num2;
         ++index1)
     {
         var strArray = usersFolder.files[index1].data.Split(Utils.newlineDelim);
         string str1;
         var str2 = str1 = "";
         var str3 = str1;
         var str4 = str1;
         var str5 = str1;
         for (var index2 = 0; index2 < strArray.Length; ++index2)
         {
             if (strArray[index2].StartsWith("USER"))
                 str5 = getDataFromConfigLine(strArray[index2], ": ");
             if (strArray[index2].StartsWith("Rank"))
                 str2 = getDataFromConfigLine(strArray[index2], ": ");
             if (strArray[index2].StartsWith("Handle"))
                 str4 = getDataFromConfigLine(strArray[index2], ": ");
             if (strArray[index2].StartsWith("Date"))
                 str3 = getDataFromConfigLine(strArray[index2], ": ");
         }
         var destinationRectangle = new Rectangle(rectangle.X + (bounds.Width - 60) - 10, rectangle.Y + 2,
             rectangle.Height + 1, bounds.Width - 60);
         GuiData.spriteBatch.Draw(Utils.gradient, destinationRectangle, new Rectangle?(), themeColorLine,
             1.570796f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.8f);
         TextItem.doSmallLabel(new Vector2(rectangle.X, rectangle.Y),
             "#" + str5 + " - \"" + str4 + "\" Rank:" + str2, new Color?());
         rectangle.Y += 18;
         TextItem.doFontLabel(new Vector2(rectangle.X, rectangle.Y), "Joined " + str3, GuiData.detailfont,
             new Color?(), float.MaxValue, float.MaxValue);
         rectangle.Y += rectangle.Height - 10;
         num4 = index1;
     }
     rectangle.Y += 16;
     if (userListPageNumber > 0 &&
         Button.doButton(101005, rectangle.X, rectangle.Y, rectangle.Width/2 - 20, 15, "Previous Page",
             new Color?()))
         --userListPageNumber;
     TextItem.doTinyLabel(new Vector2(rectangle.X + rectangle.Width/2 - 8, rectangle.Y),
         string.Concat(userListPageNumber), new Color?());
     if (usersFolder.files.Count <= num4 + 1 ||
         !Button.doButton(101010, rectangle.X + rectangle.Width/2 + 10, rectangle.Y, rectangle.Width/2 - 10, 15,
             "Next Page", new Color?()))
         return;
     ++userListPageNumber;
 }
예제 #16
0
 private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
 {
     var stringForContractFile = getIDStringForContractFile(listingsFolder.files[selectedElementIndex]);
     if (!listingMissions.ContainsKey(stringForContractFile))
         return;
     var mission = listingMissions[stringForContractFile];
     var vector2 = new Vector2(bounds.X + 20, bounds.Y + 20);
     TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(0), 0.0f),
         "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), bounds.Width/2, 40f);
     vector2.Y += 40f;
     TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(1), 0.0f), mission.postingTitle, GuiData.font,
         new Color?(), bounds.Width - 30, float.MaxValue);
     vector2.Y += 30f;
     var text = DisplayModule.cleanSplitForWidth(mission.postingBody, bounds.Width - 110);
     TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(2), 0.0f), text, GuiData.smallfont,
         new Color?(), bounds.Width - 20, float.MaxValue);
     var num = Math.Max(135, bounds.Height/6);
     if (Button.doButton(2171618, bounds.X + 20 + getTransitionOffset(3), bounds.Y + bounds.Height - num,
         bounds.Width/5, 30, "Back", new Color?()))
     {
         state = HubState.Listing;
         screenTransition = 1f;
     }
     if (os.currentMission == null)
     {
         if (
             !Button.doButton(2171615, bounds.X + 20 + getTransitionOffset(4),
                 bounds.Y + bounds.Height - num - 40, bounds.Width/5, 30, "Accept", os.highlightColor))
             return;
         acceptMission(mission, selectedElementIndex, stringForContractFile);
         state = HubState.Listing;
         screenTransition = 1f;
     }
     else
         TextItem.doFontLabelToSize(
             new Rectangle(bounds.X + 20 + getTransitionOffset(4), bounds.Y + bounds.Height - num - 40,
                 bounds.Width/2, 30), "Abort current contract to accept new ones.", GuiData.smallfont,
             Color.White);
 }
예제 #17
0
 private Rectangle doListingScreenBackground(Rectangle bounds, SpriteBatch sb)
 {
     var destinationRectangle1 = new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2);
     sb.Draw(Utils.white, destinationRectangle1, themeColorBackground);
     doLoggedInScreenDetailing(bounds, sb);
     destinationRectangle1.Height = 5;
     destinationRectangle1.Width = 0;
     destinationRectangle1.Y += 12;
     if (thinBarcodeTop == null)
         thinBarcodeTop = new ThinBarcode(bounds.Width - 4, 5);
     if (thinBarcodeBot == null)
         thinBarcodeBot = new ThinBarcode(bounds.Width - 4, 5);
     thinBarcodeTop.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, themeColor);
     TextItem.doFontLabel(new Vector2(bounds.X + 20, destinationRectangle1.Y + 10), "MISSION LISTING",
         GuiData.titlefont, themeColor, bounds.Width - 40, 35f);
     destinationRectangle1.Y += 45;
     destinationRectangle1.X = bounds.X + 1;
     thinBarcodeBot.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, themeColor);
     destinationRectangle1.Y += 10;
     destinationRectangle1.X = bounds.X + 1;
     destinationRectangle1.Width = decorationPanel.Width;
     destinationRectangle1.Height = decorationPanel.Height;
     sb.Draw(decorationPanel, destinationRectangle1, themeColor);
     destinationRectangle1.X += destinationRectangle1.Width;
     destinationRectangle1.Width = bounds.Width - 2 - destinationRectangle1.Width;
     sb.Draw(decorationPanelSide, destinationRectangle1, themeColor);
     var pos = new Vector2(bounds.X + 6, destinationRectangle1.Y + decorationPanel.Height/2 - 8);
     var height = (int) (decorationPanel.Height*0.300000011920929);
     var num1 = (float) ((decorationPanel.Height - (double) height)/2.0);
     var destinationRectangle2 = new Rectangle(bounds.X + 1, (int) (destinationRectangle1.Y + (double) num1),
         decorationPanel.Width, height);
     var rectangle = new Rectangle(0, (int) ((decorationPanel.Height - (double) height)/2.0),
         decorationPanel.Width, height);
     var flag1 = Button.outlineOnly;
     var flag2 = Button.drawingOutline;
     Button.outlineOnly = true;
     Button.drawingOutline = false;
     var myID = 974748322;
     var color = GuiData.active == myID
         ? Color.Black
         : (GuiData.hot == myID ? themeColorLine : themeColorBackground);
     sb.Draw(decorationPanel, destinationRectangle2, rectangle, color, 0.0f, Vector2.Zero, SpriteEffects.None,
         0.6f);
     if (Button.doButton(myID, bounds.X + 1, destinationRectangle1.Y + decorationPanel.Height/6 + 4,
         decorationPanel.Width - 30, (int) (decorationPanel.Height - decorationPanel.Height/6*3.20000004768372),
         "Back", Color.Transparent))
     {
         screenTransition = 1f;
         state = HubState.Menu;
     }
     Button.outlineOnly = flag1;
     Button.drawingOutline = flag2;
     pos.X += decorationPanel.Width - 10;
     pos.Y += 4f;
     var text1 = "CSEC secure contract listing panel : Verified Connection : Token last verfied " + DateTime.Now;
     TextItem.doFontLabel(pos, text1, GuiData.detailfont, themeColor, destinationRectangle1.Width - 10f, 14f);
     pos.Y += 12f;
     if (missionListPageNumber > 0 &&
         Button.doButton(188278101, (int) pos.X, (int) pos.Y, 45, 20, "<", new Color?()))
     {
         --missionListPageNumber;
         screenTransition = 1f;
     }
     destinationRectangle1.X += 50;
     var num2 = listingsFolder.files.Count/missionListDisplayed + 1;
     var text2 = (missionListPageNumber + 1).ToString() + "/" + num2;
     var num3 = (float) (50.0 - GuiData.smallfont.MeasureString(text2).X/2.0);
     sb.DrawString(GuiData.smallfont, text2, new Vector2(destinationRectangle1.X + num3, (int) pos.Y + 1),
         Color.White);
     destinationRectangle1.X += 100;
     if (missionListPageNumber < num2 - 1 &&
         Button.doButton(188278102, destinationRectangle1.X, (int) pos.Y, 45, 20, ">", new Color?()))
     {
         ++missionListPageNumber;
         screenTransition = 1f;
     }
     destinationRectangle1.Y += decorationPanel.Height + 4;
     destinationRectangle1.Width = bounds.Width - 2;
     destinationRectangle1.X = bounds.X + 1;
     destinationRectangle1.Height = 7;
     sb.Draw(Utils.white, destinationRectangle1, themeColor);
     destinationRectangle1.Y += destinationRectangle1.Height;
     return new Rectangle(bounds.X, destinationRectangle1.Y, bounds.Width,
         bounds.Height - bounds.Height/12 - (destinationRectangle1.Y - bounds.Y));
 }
예제 #18
0
 private void doMenuScreen(Rectangle bounds, SpriteBatch sb)
 {
     var rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height/3 + 10, bounds.Width/2, 40);
     if (Button.doButton(101010, rectangle.X + getTransitionOffset(0), rectangle.Y, rectangle.Width,
         rectangle.Height, "Contract Listing", themeColor))
     {
         state = HubState.Listing;
         screenTransition = 1f;
     }
     rectangle.Y += rectangle.Height + 5;
     if (Button.doButton(101015, rectangle.X + getTransitionOffset(1), rectangle.Y, rectangle.Width,
         rectangle.Height, "User List", themeColor))
     {
         state = HubState.UserList;
         screenTransition = 1f;
     }
     rectangle.Y += rectangle.Height + 5;
     if (
         Button.doButton(101017, rectangle.X + getTransitionOffset(1), rectangle.Y, rectangle.Width,
             rectangle.Height/2, "Abort Current Contract", os.currentMission == null ? Color.Black : themeColor) &&
         os.currentMission != null)
     {
         state = HubState.CancelContract;
         screenTransition = 1f;
     }
     rectangle.Y += rectangle.Height/2 + 5;
     if (Button.doButton(102015, rectangle.X + getTransitionOffset(3), rectangle.Y, rectangle.Width,
         rectangle.Height/2, "Exit", os.lockedColor))
         os.display.command = "connect";
     rectangle.Y += rectangle.Height + 5;
 }
예제 #19
0
 public GameHub(HubState _hubState)
 {
     hubState = _hubState;
 }
예제 #20
0
        private void drawMissionEntry(Rectangle bounds, SpriteBatch sb, ActiveMission mission, int index)
        {
            var flag1 = false;

            if (mission.postingAcceptFlagRequirements != null)
            {
                for (var index1 = 0; index1 < mission.postingAcceptFlagRequirements.Length; ++index1)
                {
                    if (!os.Flags.HasFlag(mission.postingAcceptFlagRequirements[index1]))
                    {
                        flag1 = true;
                    }
                }
            }
            var myID  = index * 139284 + 984275 + index;
            var flag2 = Button.outlineOnly;
            var flag3 = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            if (GuiData.active == myID)
            {
                sb.Draw(Utils.white, bounds, Color.Black);
            }
            else if (GuiData.hot == myID)
            {
                sb.Draw(Utils.white, bounds, themeColor * 0.12f);
            }
            else
            {
                var color = index % 2 == 0 ? themeColorLine : themeColorBackground;
                if (flag1)
                {
                    color = Color.Lerp(color, Color.Gray, 0.25f);
                }
                sb.Draw(Utils.white, bounds, color);
            }
            if (flag1)
            {
                var destinationRectangle = bounds;
                destinationRectangle.Height -= 6;
                destinationRectangle.Y      += 3;
                destinationRectangle.X      += bounds.Width - bounds.Height - 6;
                destinationRectangle.Width   = destinationRectangle.Height;
                sb.Draw(lockIcon, destinationRectangle, Color.White * 0.2f);
            }
            if (!flag1 && Button.doButton(myID, bounds.X, bounds.Y, bounds.Width, bounds.Height, "", Color.Transparent))
            {
                selectedElementIndex = index;
                state            = HubState.ContractPreview;
                screenTransition = 1f;
            }
            var text1 = mission.postingTitle ?? "";

            TextItem.doFontLabel(new Vector2(bounds.X + 1 + getTransitionOffset(index), bounds.Y + 3), text1,
                                 GuiData.smallfont, Color.White, bounds.Width, float.MaxValue);
            var text2 = "Target: " + mission.target + " -- Client: " + mission.client + " -- Key: " +
                        mission.generationKeys;

            TextItem.doFontLabel(new Vector2(bounds.X + 1, bounds.Y + bounds.Height - 16), text2, GuiData.detailfont,
                                 Color.White * 0.3f, bounds.Width, 13f);
            bounds.Y     += bounds.Height - 1;
            bounds.Height = 1;
            sb.Draw(Utils.white, bounds, themeColor * 0.2f);
            Button.outlineOnly    = flag2;
            Button.drawingOutline = flag3;
        }
예제 #21
0
 public override void navigatedTo()
 {
     base.navigatedTo();
     screenTransition = 1f;
     state = HubState.Welcome;
     missionListPageNumber = 0;
     if (thinBarcodeTop != null)
         thinBarcodeTop.regenerate();
     if (thinBarcodeBot == null)
         return;
     thinBarcodeBot.regenerate();
 }
예제 #22
0
        private void doUserListScreen(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(101801, bounds.X + 2, bounds.Y + 20, bounds.Width / 4, 22, "Back", themeColor))
            {
                state = HubState.Menu;
            }
            var rectangle = new Rectangle(bounds.X + 30, bounds.Y + 50, bounds.Width / 2, 30);
            var num1      = 18 + rectangle.Height - 8;
            var num2      = (bounds.Height - 90) / num1;
            var num3      = num2 * userListPageNumber;
            var num4      = 0;

            for (var index1 = num2 * userListPageNumber;
                 index1 < usersFolder.files.Count && index1 < num3 + num2;
                 ++index1)
            {
                var    strArray = usersFolder.files[index1].data.Split(Utils.newlineDelim);
                string str1;
                var    str2 = str1 = "";
                var    str3 = str1;
                var    str4 = str1;
                var    str5 = str1;
                for (var index2 = 0; index2 < strArray.Length; ++index2)
                {
                    if (strArray[index2].StartsWith("USER"))
                    {
                        str5 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Rank"))
                    {
                        str2 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Handle"))
                    {
                        str4 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Date"))
                    {
                        str3 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                }
                var destinationRectangle = new Rectangle(rectangle.X + (bounds.Width - 60) - 10, rectangle.Y + 2,
                                                         rectangle.Height + 1, bounds.Width - 60);
                GuiData.spriteBatch.Draw(Utils.gradient, destinationRectangle, new Rectangle?(), themeColorLine,
                                         1.570796f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.8f);
                TextItem.doSmallLabel(new Vector2(rectangle.X, rectangle.Y),
                                      "#" + str5 + " - \"" + str4 + "\" Rank:" + str2, new Color?());
                rectangle.Y += 18;
                TextItem.doFontLabel(new Vector2(rectangle.X, rectangle.Y), "Joined " + str3, GuiData.detailfont,
                                     new Color?(), float.MaxValue, float.MaxValue);
                rectangle.Y += rectangle.Height - 10;
                num4         = index1;
            }
            rectangle.Y += 16;
            if (userListPageNumber > 0 &&
                Button.doButton(101005, rectangle.X, rectangle.Y, rectangle.Width / 2 - 20, 15, "Previous Page",
                                new Color?()))
            {
                --userListPageNumber;
            }
            TextItem.doTinyLabel(new Vector2(rectangle.X + rectangle.Width / 2 - 8, rectangle.Y),
                                 string.Concat(userListPageNumber), new Color?());
            if (usersFolder.files.Count <= num4 + 1 ||
                !Button.doButton(101010, rectangle.X + rectangle.Width / 2 + 10, rectangle.Y, rectangle.Width / 2 - 10, 15,
                                 "Next Page", new Color?()))
            {
                return;
            }
            ++userListPageNumber;
        }
예제 #23
0
 public override void loginGoBack()
 {
     base.loginGoBack();
     state            = HubState.Welcome;
     screenTransition = 1f;
 }
예제 #24
0
 private void doCancelContractScreen(Rectangle bounds, SpriteBatch sb)
 {
     var rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height/3 + 10, bounds.Width/2, 40);
     TextItem.doFontLabel(new Vector2(rectangle.X, rectangle.Y),
         "Are you sure you with to abandon your current contract?\nThis cannot be reversed.", GuiData.font,
         Color.White, bounds.Width - 30, rectangle.Height);
     rectangle.Y += rectangle.Height + 4;
     if (
         Button.doButton(142011, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, "Abandon Contract",
             Color.Red) && os.currentMission != null)
     {
         os.currentMission = null;
         os.currentFaction.contractAbbandoned(os);
         screenTransition = 0.0f;
         state = HubState.Menu;
     }
     rectangle.Y += rectangle.Height + 10;
     if (
         !Button.doButton(142015, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, "Back", themeColor))
         return;
     screenTransition = 1f;
     state = HubState.Menu;
 }
예제 #25
0
 private void drawMissionEntry(Rectangle bounds, SpriteBatch sb, ActiveMission mission, int index)
 {
     var flag1 = false;
     if (mission.postingAcceptFlagRequirements != null)
     {
         for (var index1 = 0; index1 < mission.postingAcceptFlagRequirements.Length; ++index1)
         {
             if (!os.Flags.HasFlag(mission.postingAcceptFlagRequirements[index1]))
                 flag1 = true;
         }
     }
     var myID = index*139284 + 984275 + index;
     var flag2 = Button.outlineOnly;
     var flag3 = Button.drawingOutline;
     Button.outlineOnly = true;
     Button.drawingOutline = false;
     if (GuiData.active == myID)
         sb.Draw(Utils.white, bounds, Color.Black);
     else if (GuiData.hot == myID)
     {
         sb.Draw(Utils.white, bounds, themeColor*0.12f);
     }
     else
     {
         var color = index%2 == 0 ? themeColorLine : themeColorBackground;
         if (flag1)
             color = Color.Lerp(color, Color.Gray, 0.25f);
         sb.Draw(Utils.white, bounds, color);
     }
     if (flag1)
     {
         var destinationRectangle = bounds;
         destinationRectangle.Height -= 6;
         destinationRectangle.Y += 3;
         destinationRectangle.X += bounds.Width - bounds.Height - 6;
         destinationRectangle.Width = destinationRectangle.Height;
         sb.Draw(lockIcon, destinationRectangle, Color.White*0.2f);
     }
     if (!flag1 && Button.doButton(myID, bounds.X, bounds.Y, bounds.Width, bounds.Height, "", Color.Transparent))
     {
         selectedElementIndex = index;
         state = HubState.ContractPreview;
         screenTransition = 1f;
     }
     var text1 = mission.postingTitle ?? "";
     TextItem.doFontLabel(new Vector2(bounds.X + 1 + getTransitionOffset(index), bounds.Y + 3), text1,
         GuiData.smallfont, Color.White, bounds.Width, float.MaxValue);
     var text2 = "Target: " + mission.target + " -- Client: " + mission.client + " -- Key: " +
                 mission.generationKeys;
     TextItem.doFontLabel(new Vector2(bounds.X + 1, bounds.Y + bounds.Height - 16), text2, GuiData.detailfont,
         Color.White*0.3f, bounds.Width, 13f);
     bounds.Y += bounds.Height - 1;
     bounds.Height = 1;
     sb.Draw(Utils.white, bounds, themeColor*0.2f);
     Button.outlineOnly = flag2;
     Button.drawingOutline = flag3;
 }
예제 #26
0
 public override void loginGoBack()
 {
     base.loginGoBack();
     state = HubState.Welcome;
     screenTransition = 1f;
 }
예제 #27
0
        private Rectangle doListingScreenBackground(Rectangle bounds, SpriteBatch sb)
        {
            var destinationRectangle1 = new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2);

            sb.Draw(Utils.white, destinationRectangle1, themeColorBackground);
            doLoggedInScreenDetailing(bounds, sb);
            destinationRectangle1.Height = 5;
            destinationRectangle1.Width  = 0;
            destinationRectangle1.Y     += 12;
            if (thinBarcodeTop == null)
            {
                thinBarcodeTop = new ThinBarcode(bounds.Width - 4, 5);
            }
            if (thinBarcodeBot == null)
            {
                thinBarcodeBot = new ThinBarcode(bounds.Width - 4, 5);
            }
            thinBarcodeTop.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, themeColor);
            TextItem.doFontLabel(new Vector2(bounds.X + 20, destinationRectangle1.Y + 10), "MISSION LISTING",
                                 GuiData.titlefont, themeColor, bounds.Width - 40, 35f);
            destinationRectangle1.Y += 45;
            destinationRectangle1.X  = bounds.X + 1;
            thinBarcodeBot.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, themeColor);
            destinationRectangle1.Y     += 10;
            destinationRectangle1.X      = bounds.X + 1;
            destinationRectangle1.Width  = decorationPanel.Width;
            destinationRectangle1.Height = decorationPanel.Height;
            sb.Draw(decorationPanel, destinationRectangle1, themeColor);
            destinationRectangle1.X    += destinationRectangle1.Width;
            destinationRectangle1.Width = bounds.Width - 2 - destinationRectangle1.Width;
            sb.Draw(decorationPanelSide, destinationRectangle1, themeColor);
            var pos    = new Vector2(bounds.X + 6, destinationRectangle1.Y + decorationPanel.Height / 2 - 8);
            var height = (int)(decorationPanel.Height * 0.300000011920929);
            var num1   = (float)((decorationPanel.Height - (double)height) / 2.0);
            var destinationRectangle2 = new Rectangle(bounds.X + 1, (int)(destinationRectangle1.Y + (double)num1),
                                                      decorationPanel.Width, height);
            var rectangle = new Rectangle(0, (int)((decorationPanel.Height - (double)height) / 2.0),
                                          decorationPanel.Width, height);
            var flag1 = Button.outlineOnly;
            var flag2 = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            var myID  = 974748322;
            var color = GuiData.active == myID
                ? Color.Black
                : (GuiData.hot == myID ? themeColorLine : themeColorBackground);

            sb.Draw(decorationPanel, destinationRectangle2, rectangle, color, 0.0f, Vector2.Zero, SpriteEffects.None,
                    0.6f);
            if (Button.doButton(myID, bounds.X + 1, destinationRectangle1.Y + decorationPanel.Height / 6 + 4,
                                decorationPanel.Width - 30, (int)(decorationPanel.Height - decorationPanel.Height / 6 * 3.20000004768372),
                                "Back", Color.Transparent))
            {
                screenTransition = 1f;
                state            = HubState.Menu;
            }
            Button.outlineOnly    = flag1;
            Button.drawingOutline = flag2;
            pos.X += decorationPanel.Width - 10;
            pos.Y += 4f;
            var text1 = "CSEC secure contract listing panel : Verified Connection : Token last verfied " + DateTime.Now;

            TextItem.doFontLabel(pos, text1, GuiData.detailfont, themeColor, destinationRectangle1.Width - 10f, 14f);
            pos.Y += 12f;
            if (missionListPageNumber > 0 &&
                Button.doButton(188278101, (int)pos.X, (int)pos.Y, 45, 20, "<", new Color?()))
            {
                --missionListPageNumber;
                screenTransition = 1f;
            }
            destinationRectangle1.X += 50;
            var num2  = listingsFolder.files.Count / missionListDisplayed + 1;
            var text2 = (missionListPageNumber + 1).ToString() + "/" + num2;
            var num3  = (float)(50.0 - GuiData.smallfont.MeasureString(text2).X / 2.0);

            sb.DrawString(GuiData.smallfont, text2, new Vector2(destinationRectangle1.X + num3, (int)pos.Y + 1),
                          Color.White);
            destinationRectangle1.X += 100;
            if (missionListPageNumber < num2 - 1 &&
                Button.doButton(188278102, destinationRectangle1.X, (int)pos.Y, 45, 20, ">", new Color?()))
            {
                ++missionListPageNumber;
                screenTransition = 1f;
            }
            destinationRectangle1.Y     += decorationPanel.Height + 4;
            destinationRectangle1.Width  = bounds.Width - 2;
            destinationRectangle1.X      = bounds.X + 1;
            destinationRectangle1.Height = 7;
            sb.Draw(Utils.white, destinationRectangle1, themeColor);
            destinationRectangle1.Y += destinationRectangle1.Height;
            return(new Rectangle(bounds.X, destinationRectangle1.Y, bounds.Width,
                                 bounds.Height - bounds.Height / 12 - (destinationRectangle1.Y - bounds.Y)));
        }
예제 #28
0
 public override void userLoggedIn()
 {
     base.userLoggedIn();
     activeUserName = user.name;
     state = HubState.Menu;
     screenTransition = 1f;
     activeUserLoginTime = DateTime.Now;
 }
예제 #29
0
 public HubService(HubState hubState)
 {
     _hubState = hubState;
 }