-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
3,589 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.ComponentModel; | ||
|
||
namespace ClientCore.Enums; | ||
|
||
public enum ProgressBarModeEnum | ||
{ | ||
Determinate = 0, | ||
Indeterminate = 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace ClientCore.Exceptions | ||
{ | ||
public class ClientException : Exception | ||
{ | ||
public ClientException(string message, Exception innerException = null) : base(message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Net; | ||
|
||
namespace ClientCore.Exceptions | ||
{ | ||
public class ClientRequestException : ClientException | ||
{ | ||
public HttpStatusCode? StatusCode { get; } | ||
|
||
public ClientRequestException(string message, HttpStatusCode? statusCode = null) : base(message) | ||
{ | ||
StatusCode = statusCode; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System; | ||
using ClientCore.Enums; | ||
using Microsoft.Xna.Framework; | ||
using Rampastring.Tools; | ||
using Rampastring.XNAUI; | ||
using Rampastring.XNAUI.XNAControls; | ||
|
||
namespace ClientGUI; | ||
|
||
public class XNAClientProgressBar : XNAProgressBar | ||
{ | ||
public int Speed { get; set; } = 4; | ||
|
||
public double WidthRatio { get; set; } = 0.25; | ||
|
||
public ProgressBarModeEnum ProgressBarMode { get; set; } | ||
|
||
private int _left { get; set; } | ||
|
||
public XNAClientProgressBar(WindowManager windowManager) : base(windowManager) | ||
{ | ||
} | ||
|
||
public override void Update(GameTime gameTime) | ||
{ | ||
_left = (_left + Speed) % Width; | ||
|
||
base.Update(gameTime); | ||
} | ||
|
||
public override void Draw(GameTime gameTime) | ||
{ | ||
switch (ProgressBarMode) | ||
{ | ||
case ProgressBarModeEnum.Indeterminate: | ||
DrawIndeterminateMode(gameTime); | ||
return; | ||
case ProgressBarModeEnum.Determinate: | ||
default: | ||
base.Draw(gameTime); | ||
return; | ||
} | ||
} | ||
|
||
public void DrawIndeterminateMode(GameTime gameTime) | ||
{ | ||
Rectangle wrect = RenderRectangle(); | ||
int filledWidth = (int)(wrect.Width * WidthRatio); | ||
|
||
for (int i = 0; i < BorderWidth; i++) | ||
{ | ||
var rect = new Rectangle(wrect.X + i, wrect.Y + i, wrect.Width - i, wrect.Height - i); | ||
|
||
Renderer.DrawRectangle(rect, BorderColor); | ||
} | ||
|
||
Renderer.FillRectangle(new Rectangle(wrect.X + BorderWidth, wrect.Y + BorderWidth, wrect.Width - BorderWidth * 2, wrect.Height - BorderWidth * 2), UnfilledColor); | ||
|
||
if (_left + filledWidth > wrect.Width - BorderWidth * 2) | ||
{ | ||
Renderer.FillRectangle(new Rectangle(wrect.X + BorderWidth, wrect.Y + BorderWidth, (_left + filledWidth) - (wrect.Width - (BorderWidth * 2)), wrect.Height - BorderWidth * 2), FilledColor); | ||
} | ||
|
||
Renderer.FillRectangle(new Rectangle(wrect.X + BorderWidth + _left, wrect.Y + BorderWidth, Math.Min(filledWidth, wrect.Width - (BorderWidth * 2) - _left), wrect.Height - BorderWidth * 2), FilledColor); | ||
} | ||
|
||
public override void ParseAttributeFromINI(IniFile iniFile, string key, string value) | ||
{ | ||
switch (key) | ||
{ | ||
case "WidthRatio": | ||
WidthRatio = double.Parse(value); | ||
return; | ||
case "ProgressBarMode": | ||
ProgressBarMode = (ProgressBarModeEnum)Enum.Parse(typeof(ProgressBarModeEnum), value); | ||
return; | ||
case "Speed": | ||
Speed = int.Parse(value); | ||
return; | ||
default: | ||
base.ParseAttributeFromINI(iniFile, key, value); | ||
return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Rampastring.XNAUI; | ||
using Rampastring.XNAUI.XNAControls; | ||
|
||
namespace ClientGUI; | ||
|
||
public class XNAScrollablePanel : XNAPanel | ||
{ | ||
public XNAScrollablePanel(WindowManager windowManager) : base(windowManager) | ||
{ | ||
DrawMode = ControlDrawMode.UNIQUE_RENDER_TARGET; | ||
} | ||
} |
Oops, something went wrong.