GetFirst()
46 | {
47 | throw new NotImplementedException();
48 | }
49 |
50 | public void Reinsert(string username)
51 | {
52 | throw new NotImplementedException();
53 | }
54 |
55 | public bool Remove(string username)
56 | {
57 | return dictionary.Remove(username.ToLower());
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/RA2Client/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Ra2Client": {
4 | "commandName": "Project",
5 | "commandLineArgs": "-NOLOGO"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/RA2Client/RA2Client.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_LastSelectedProfileId>E:\Documents\My_File\Clone\Ra2Client\Properties\PublishProfiles\FolderProfile.pubxml
5 |
6 |
--------------------------------------------------------------------------------
/RA2Client/Resources/Allied.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/Allied.png
--------------------------------------------------------------------------------
/RA2Client/Resources/Soviet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/Soviet.png
--------------------------------------------------------------------------------
/RA2Client/Resources/Yuri.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/Yuri.png
--------------------------------------------------------------------------------
/RA2Client/Resources/chat_ic_lv1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/chat_ic_lv1.png
--------------------------------------------------------------------------------
/RA2Client/Resources/chat_ic_lv2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/chat_ic_lv2.png
--------------------------------------------------------------------------------
/RA2Client/Resources/chat_ic_lv3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/chat_ic_lv3.png
--------------------------------------------------------------------------------
/RA2Client/Resources/chat_ic_lv4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/chat_ic_lv4.png
--------------------------------------------------------------------------------
/RA2Client/Resources/chat_ic_lv5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/chat_ic_lv5.png
--------------------------------------------------------------------------------
/RA2Client/Resources/chat_ic_lv6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/chat_ic_lv6.png
--------------------------------------------------------------------------------
/RA2Client/Resources/noMapPreview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/noMapPreview.png
--------------------------------------------------------------------------------
/RA2Client/Resources/skillLevel1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/skillLevel1.png
--------------------------------------------------------------------------------
/RA2Client/Resources/skillLevel2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/skillLevel2.png
--------------------------------------------------------------------------------
/RA2Client/Resources/skillLevel3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/skillLevel3.png
--------------------------------------------------------------------------------
/RA2Client/Resources/中立.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/Resources/中立.png
--------------------------------------------------------------------------------
/RA2Client/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/RA2Client/clienticon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/RA2Client/clienticon.ico
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 红色警戒2 重聚未来 1.5 开发者文档
2 |
3 |
4 | 
5 |
6 | **本项目基于: [xna-cncnet-client](https://github.com/CnCNet/xna-cncnet-client)**
7 |
8 |
9 |
10 | ## 项目结构
11 |
12 | ### ClientCore
13 |
14 | 这里放的是一些底层的数据结构和方法.
15 |
16 | ### ClientGUI
17 |
18 | 这里放的是三次开发的UI控件.
19 |
20 | ### ClientUpdater
21 |
22 | 这里是更新程序,独立于客户端的.
23 |
24 | ### DTAConfig
25 |
26 | 这里放的主要是设置界面的配置窗口.
27 |
28 | ### Localization
29 |
30 | 这里实现了多语言功能和一些扩展方法.
31 |
32 | ### RA2Client
33 |
34 | 客户端主要项目,大部分界面的实现和业务逻辑位于此.
35 |
36 | ### Rampastring.Tools-2.0.6
37 |
38 | 读写INI和一些封装的方法实现.
39 |
40 | ### Rampastring.XNAUI
41 |
42 | 这里放的是二次开发的UI控件.
43 |
44 | ### RandomMapGenerator
45 |
46 | 这是用来生成随机地图的项目.
47 |
48 | ### Reunion
49 |
50 | 这是用于生成启动游戏的exe.
51 |
52 | ### CnCNet License
53 |
54 | CnCNet Client
55 | Copyright (C) 2022-2024 CnCNet, Rampastring
56 |
57 | This program is free software: you can redistribute it and/or modify
58 | it under the terms of the GNU General Public License as published by
59 | the Free Software Foundation, either version 3 of the License, or
60 | (at your option) any later version.
61 |
62 | This program is distributed in the hope that it will be useful,
63 | but WITHOUT ANY WARRANTY; without even the implied warranty of
64 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65 | GNU General Public License for more details.
66 |
67 | You should have received a copy of the GNU General Public License
68 | along with this program. If not, see .
69 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish
2 | on:
3 | workflow_dispatch:
4 | permissions:
5 | contents: write
6 | jobs:
7 | publish:
8 | if: github.repository == 'Rampastring/Rampastring.Tools'
9 | runs-on: windows-2022
10 | steps:
11 | - name: Checkout
12 | uses: actions/checkout@main
13 | with:
14 | fetch-depth: 0
15 | - name: Setup .NET Core SDK
16 | uses: actions/setup-dotnet@main
17 | with:
18 | dotnet-version: '8.x.x'
19 | - name: Install GitVersion
20 | uses: gittools/actions/gitversion/setup@main
21 | with:
22 | versionSpec: '5.x'
23 | - name: Determine Version
24 | uses: gittools/actions/gitversion/execute@main
25 | - name: Pack
26 | run: dotnet pack Rampastring.Tools.csproj --configuration Release -p:AssemblyVersion=$env:GitVersion_AssemblySemVer -p:FileVersion=$env:GitVersion_AssemblySemFileVer -p:InformationalVersion=$env:GitVersion_InformationalVersion -p:PackageVersion=$env:GitVersion_NuGetVersionV2
27 | - name: Push
28 | run: dotnet nuget push bin\Release\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
29 | - name: Prerelease
30 | if: ${{ env.GitVersion_PreReleaseTag != '' }}
31 | run: gh release create ${{ format('v{0}', env.GitVersion_SemVer) }} --generate-notes --target ${{ github.sha }} --prerelease
32 | env:
33 | GH_TOKEN: ${{ github.token }}
34 | - name: Release
35 | if: ${{ env.GitVersion_PreReleaseTag == '' }}
36 | run: gh release create ${{ format('v{0}', env.GitVersion_SemVer) }} --generate-notes --target ${{ github.sha }}
37 | env:
38 | GH_TOKEN: ${{ github.token }}
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/BooleanStringStyle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Rampastring.Tools;
4 |
5 | ///
6 | /// Defines how boolean values are converted to strings when a is written.
7 | ///
8 | [Flags]
9 | public enum BooleanStringStyle
10 | {
11 | ///
12 | /// Write boolean values as "True" and "False".
13 | ///
14 | TRUEFALSE = 0,
15 |
16 | ///
17 | /// Write boolean values as "Yes" and "No".
18 | ///
19 | YESNO = 1,
20 |
21 | ///
22 | /// Write boolean values as "true" and "false".
23 | ///
24 | TRUEFALSE_LOWERCASE = 2,
25 |
26 | ///
27 | /// Write boolean values as "yes" and "no".
28 | ///
29 | YESNO_LOWERCASE = 3,
30 |
31 | ///
32 | /// Write boolean values as "1" and "0".
33 | ///
34 | ONEZERO = 4
35 | }
36 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/IIniFile.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.Tools;
2 |
3 | using System.IO;
4 | using System.Collections.Generic;
5 |
6 | public interface IIniFile
7 | {
8 | bool AllowNewSections { get; set; }
9 | string FileName { get; set; }
10 |
11 | IniFile AddSection(IniSection section);
12 | IniFile AddSection(string sectionName);
13 | IniFile RemoveSection(string sectionName);
14 | IniFile CombineSections(string firstSectionName, string secondSectionName);
15 | IniFile EraseSectionKeys(string sectionName);
16 | bool GetBooleanValue(string section, string key, bool defaultValue);
17 | double GetDoubleValue(string section, string key, double defaultValue);
18 | int GetIntValue(string section, string key, int defaultValue);
19 | string GetPathStringValue(string section, string key, string defaultValue);
20 | IniSection GetSection(string name);
21 | List GetSectionKeys(string sectionName);
22 | List GetSections();
23 | float GetSingleValue(string section, string key, float defaultValue);
24 | string GetStringValue(string section, string key, string defaultValue);
25 | string GetStringValue(string section, string key, string defaultValue, out bool success);
26 | bool KeyExists(string sectionName, string keyName);
27 | IniFile RemoveKey(string sectionName, string key);
28 | void Parse();
29 | IniFile Reload();
30 | bool SectionExists(string sectionName);
31 | IniFile SetBooleanValue(string section, string key, bool value);
32 | IniFile SetDoubleValue(string section, string key, double value);
33 | IniFile SetIntValue(string section, string key, int value);
34 | IniFile SetSingleValue(string section, string key, double value, int decimals);
35 | IniFile SetSingleValue(string section, string key, float value);
36 | IniFile SetSingleValue(string section, string key, float value, int decimals);
37 | IniFile SetStringValue(string section, string key, string value);
38 | IniFile WriteIniFile();
39 | IniFile WriteIniFile(string filePath);
40 | IniFile WriteIniStream(Stream stream);
41 | }
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/INIProperties/BoolProperty.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.Tools.INIProperties;
2 |
3 | ///
4 | /// A boolean to be parsed from an INI file.
5 | ///
6 | public class BoolProperty : GenericINIProperty, IIniProperty
7 | {
8 | public BoolProperty() : this(false) { }
9 |
10 | public BoolProperty(bool defaultValue) : base(defaultValue)
11 | {
12 | }
13 |
14 | public override void ParseValue(IniFile iniFile, string sectionName, string keyName)
15 | {
16 | Value = iniFile.GetBooleanValue(sectionName, keyName, DefaultValue);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/INIProperties/DoubleProperty.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.Tools.INIProperties;
2 |
3 | ///
4 | /// A double to be parsed from an INI file.
5 | ///
6 | public class DoubleProperty : GenericINIProperty, IIniProperty
7 | {
8 | public DoubleProperty() : this(0.0) { }
9 |
10 | public DoubleProperty(double defaultValue) : base(defaultValue)
11 | {
12 | }
13 |
14 | public override void ParseValue(IniFile iniFile, string sectionName, string keyName)
15 | {
16 | Value = iniFile.GetDoubleValue(sectionName, keyName, DefaultValue);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/INIProperties/EnumProperty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Rampastring.Tools.INIProperties;
4 |
5 | public class EnumProperty : GenericINIProperty, IIniProperty
6 | {
7 | public EnumProperty() : this((T)Activator.CreateInstance(typeof(T))) { }
8 |
9 | public EnumProperty(T defaultValue) : base(defaultValue)
10 | {
11 | }
12 |
13 | public override void ParseValue(IniFile iniFile, string sectionName, string keyName)
14 | {
15 | Value = (T)Enum.Parse(typeof(T),
16 | iniFile.GetStringValue(sectionName, keyName, DefaultValue.ToString()), true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/INIProperties/GenericINIProperty.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.Tools.INIProperties;
2 |
3 | public abstract class GenericINIProperty : IIniProperty
4 | {
5 | public GenericINIProperty(T defaultValue)
6 | {
7 | DefaultValue = defaultValue;
8 | }
9 |
10 | public T DefaultValue { get; private set; }
11 |
12 | public T Value { get; protected set; }
13 |
14 | public static implicit operator T(GenericINIProperty property)
15 | {
16 | return property.Value;
17 | }
18 |
19 | public abstract void ParseValue(IniFile iniFile, string sectionName, string keyName);
20 |
21 | public override string ToString()
22 | {
23 | return Value.ToString();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/INIProperties/IIniProperty.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.Tools.INIProperties;
2 |
3 | ///
4 | /// An interface for INI properties.
5 | ///
6 | public interface IIniProperty
7 | {
8 | void ParseValue(IniFile iniFile, string sectionName, string keyName);
9 | }
10 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/INIProperties/IntProperty.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.Tools.INIProperties;
2 |
3 | ///
4 | /// An integer to be parsed from an INI file.
5 | ///
6 | public class IntProperty : GenericINIProperty, IIniProperty
7 | {
8 | public IntProperty() : this(0) { }
9 |
10 | public IntProperty(int defaultValue) : base(defaultValue)
11 | {
12 | }
13 |
14 | public override void ParseValue(IniFile iniFile, string sectionName, string keyName)
15 | {
16 | Value = iniFile.GetIntValue(sectionName, keyName, DefaultValue);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/INIProperties/StringProperty.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.Tools.INIProperties;
2 |
3 | ///
4 | /// A string to be parsed from an INI file.
5 | ///
6 | public class StringProperty : GenericINIProperty, IIniProperty
7 | {
8 | public StringProperty() : this(string.Empty) { }
9 |
10 | public StringProperty(string defaultValue) : base(defaultValue)
11 | {
12 | }
13 |
14 | public override void ParseValue(IniFile iniFile, string sectionName, string keyName)
15 | {
16 | Value = iniFile.GetStringValue(sectionName, keyName, DefaultValue);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/IniParseException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Rampastring.Tools;
4 |
5 | public class IniParseException : Exception
6 | {
7 | public IniParseException(string message) : base(message)
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016-2023 Rami "Rampastring" Pasanen
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/NativeMethods.txt:
--------------------------------------------------------------------------------
1 | FlashWindowEx
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/README.md:
--------------------------------------------------------------------------------
1 | A C# library that contains generally useful tools and classes like an INI file parser, a logger class, type conversions and such.
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/Rampastring.Tools.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.3.32519.111
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rampastring.Tools", "Rampastring.Tools.csproj", "{9F40961F-535A-480C-93C5-6877ED6A8626}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{226035C5-BDF2-434A-AFE0-883481E51CCF}"
9 | ProjectSection(SolutionItems) = preProject
10 | .editorconfig = .editorconfig
11 | EndProjectSection
12 | EndProject
13 | Global
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|Any CPU = Debug|Any CPU
16 | Release|Any CPU = Release|Any CPU
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {9F40961F-535A-480C-93C5-6877ED6A8626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {9F40961F-535A-480C-93C5-6877ED6A8626}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {9F40961F-535A-480C-93C5-6877ED6A8626}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {9F40961F-535A-480C-93C5-6877ED6A8626}.Release|Any CPU.Build.0 = Release|Any CPU
23 | EndGlobalSection
24 | GlobalSection(SolutionProperties) = preSolution
25 | HideSolutionNode = FALSE
26 | EndGlobalSection
27 | GlobalSection(ExtensibilityGlobals) = postSolution
28 | SolutionGuid = {15D304AD-C81F-4A6C-A530-8B5896AAB2A9}
29 | EndGlobalSection
30 | EndGlobal
31 |
--------------------------------------------------------------------------------
/Rampastring.Tools-2.0.6/WindowFlasher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Windows.Win32;
3 | using Windows.Win32.UI.WindowsAndMessaging;
4 | using Windows.Win32.Foundation;
5 |
6 | namespace Rampastring.Tools;
7 |
8 | public static class WindowFlasher
9 | {
10 | ///
11 | /// Flashes a form's window in the taskbar.
12 | ///
13 | /// The handle of the window to flash.
14 | /// The return value fo FlashWindowEx.
15 | #if NET5_0_OR_GREATER
16 | [System.Runtime.Versioning.SupportedOSPlatform("windows5.1.2600")]
17 | #endif
18 | public static bool FlashWindowEx(IntPtr windowHandle)
19 | {
20 | int cbSize;
21 |
22 | unsafe
23 | {
24 | cbSize = sizeof(FLASHWINFO);
25 | }
26 |
27 | var pfwi = new FLASHWINFO
28 | {
29 | cbSize = (uint)cbSize,
30 | hwnd = (HWND)windowHandle,
31 | dwFlags = FLASHWINFO_FLAGS.FLASHW_ALL | FLASHWINFO_FLAGS.FLASHW_TIMERNOFG,
32 | uCount = uint.MaxValue,
33 | dwTimeout = 0u
34 | };
35 |
36 | BOOL result = PInvoke.FlashWindowEx(pfwi);
37 |
38 | return result.Value != 0;
39 | }
40 | }
--------------------------------------------------------------------------------
/Rampastring.XNAUI/BuildAll.bat:
--------------------------------------------------------------------------------
1 | dotnet build .\Rampastring.XNAUI.csproj -c WindowsDXRelease
--------------------------------------------------------------------------------
/Rampastring.XNAUI/Input/IIMEHandler.cs:
--------------------------------------------------------------------------------
1 | using Rampastring.XNAUI.XNAControls;
2 | using System;
3 |
4 | namespace Rampastring.XNAUI.Input;
5 |
6 | ///
7 | /// Interface for outside components implementing Input Method Editor (IME) support.
8 | ///
9 | public interface IIMEHandler
10 | {
11 | ///
12 | /// Determines whether IME is allowed to compose text.
13 | ///
14 | bool TextCompositionEnabled { get; }
15 |
16 | void RegisterXNATextBox(XNATextBox sender, Action handleCharInput);
17 |
18 | void KillXNATextBox(XNATextBox sender);
19 |
20 | void OnSelectedChanged(XNATextBox sender);
21 | void OnTextChanged(XNATextBox sender);
22 |
23 | bool HandleCharInput(XNATextBox sender, char input);
24 |
25 | bool HandleScrollLeftKey(XNATextBox sender);
26 | bool HandleScrollRightKey(XNATextBox sender);
27 |
28 | bool HandleBackspaceKey(XNATextBox sender);
29 | bool HandleDeleteKey(XNATextBox sender);
30 | bool HandleEnterKey(XNATextBox sender);
31 | bool HandleEscapeKey(XNATextBox sender);
32 |
33 | bool GetDrawCompositionText(XNATextBox sender, out string composition, out int compositionCursorPosition);
34 | }
35 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/Input/KeyboardEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Rampastring.XNAUI.Input
4 | {
5 | public class KeyboardEventArgs : EventArgs
6 | {
7 | public KeyboardEventArgs(char character, int lParam)
8 | {
9 | this.Character = character;
10 | this.Param = lParam;
11 | }
12 |
13 | public char Character { get; private set; }
14 |
15 | public int Param { get; private set; }
16 |
17 | public int RepeatCount
18 | {
19 | get { return Param & 0xffff; }
20 | }
21 |
22 | public bool ExtendedKey
23 | {
24 | get { return (Param & (1 << 24)) > 0; }
25 | }
26 |
27 | public bool AltPressed
28 | {
29 | get { return (Param & (1 << 29)) > 0; }
30 | }
31 |
32 | public bool PreviousState
33 | {
34 | get { return (Param & (1 << 30)) > 0; }
35 | }
36 |
37 | public bool TransitionState
38 | {
39 | get { return (Param & (1 << 31)) > 0; }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/NativeMethods.txt:
--------------------------------------------------------------------------------
1 | LoadCursorFromFile
2 | ImmGetContext
3 | ImmAssociateContext
4 | ImmReleaseContext
5 | WM_GETDLGCODE
6 | WM_CHAR
7 | WM_IME_SETCONTEXT
8 | WM_INPUTLANGCHANGE
9 | DLGC_WANTALLKEYS
10 | WINDOW_LONG_PTR_INDEX
11 | //CallWindowProc
12 | //SetWindowLong
13 | //SetWindowLongPtr
14 | LRESULT
15 | WPARAM
16 | LPARAM
17 | WNDPROC
--------------------------------------------------------------------------------
/Rampastring.XNAUI/PackAll.bat:
--------------------------------------------------------------------------------
1 | dotnet pack .\Rampastring.XNAUI.csproj -c WindowsDXRelease
2 | dotnet pack .\Rampastring.XNAUI.csproj -c WindowsDXDebug
3 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/PlatformSpecific/IGameWindowManager.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Windows.Forms;
4 |
5 |
6 | namespace Rampastring.XNAUI.PlatformSpecific;
7 |
8 | internal interface IGameWindowManager
9 | {
10 |
11 | event EventHandler GameWindowClosing;
12 | event EventHandler ClientSizeChanged;
13 |
14 | void AllowClosing();
15 | #if NET5_0_OR_GREATER
16 | [System.Runtime.Versioning.SupportedOSPlatform("windows5.1.2600")]
17 | #endif
18 | void FlashWindow();
19 | IntPtr GetWindowHandle();
20 | void HideWindow();
21 | void MaximizeWindow();
22 | void MinimizeWindow();
23 | void PreventClosing();
24 | void SetMaximizeBox(bool value);
25 | void SetControlBox(bool value);
26 | void SetIcon(string path);
27 | void ShowWindow();
28 | int GetWindowWidth();
29 | int GetWindowHeight();
30 | void SetFormBorderStyle(FormBorderStyle borderStyle);
31 |
32 | bool HasFocus();
33 | void CenterOnScreen();
34 | void SetBorderlessMode(bool value);
35 | }
--------------------------------------------------------------------------------
/Rampastring.XNAUI/README.md:
--------------------------------------------------------------------------------
1 | A simple XNA Framework / MonoGame UI library. General-purpose, although mainly used in the CnCNet client: https://github.com/CnCNet/xna-cncnet-client
2 |
3 | Includes its own window management and UI control classes.
4 |
5 | References:
6 | - MonoGame or XNA Game Studio 4.0 Refresh
7 | - Rampastring.Tools
8 |
9 | Compiled versions of MonoGame and Rampastring.Tools are included in the repository.
10 |
11 | For an usage example, see https://github.com/CnCNet/xna-cncnet-client/blob/master/DXMainClient/DXGUI/GameClass.cs
12 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/RMath.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using System;
3 |
4 | namespace Rampastring.XNAUI;
5 |
6 | ///
7 | /// Contains static vector math functions.
8 | ///
9 | public static class RMath
10 | {
11 | ///
12 | /// Returns the angle / direction of a vector in radians.
13 | ///
14 | /// The vector.
15 | public static float AngleFromVector(Vector2 vector)
16 | {
17 | return (float)Math.Atan2(vector.Y, vector.X);
18 | }
19 |
20 | ///
21 | /// Creates and returns a new vector with the given length and angle.
22 | ///
23 | /// The length of the vector.
24 | /// The angle of the vector.
25 | public static Vector2 VectorFromLengthAndAngle(float length, float angle)
26 | {
27 | return new Vector2(length * (float)Math.Cos(angle), length * (float)Math.Sin(angle));
28 | }
29 |
30 | public static Color MultiplyAlpha(Color color)
31 | {
32 | return new Color((color.A * color.R) / 255,
33 | (color.A * color.G) / 255,
34 | (color.A * color.B) / 255,
35 | color.A);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/Rampastring.XNAUI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32414.248
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rampastring.XNAUI", "Rampastring.XNAUI.csproj", "{3EAF996D-7F03-433B-A9A5-17E69AC97C76}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {3EAF996D-7F03-433B-A9A5-17E69AC97C76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {3EAF996D-7F03-433B-A9A5-17E69AC97C76}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {3EAF996D-7F03-433B-A9A5-17E69AC97C76}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {3EAF996D-7F03-433B-A9A5-17E69AC97C76}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {F8EE831B-908F-4F0A-87BB-D97DC5FF5027}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Avatar.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Avatar.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Game.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Game.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.GamerServices.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.GamerServices.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Graphics.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Graphics.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Input.Touch.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Input.Touch.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Net.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Storage.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Storage.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Video.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Video.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Xact.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.Xact.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/References/XNA/Microsoft.Xna.Framework.dll
--------------------------------------------------------------------------------
/Rampastring.XNAUI/UISettings.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using Microsoft.Xna.Framework.Graphics;
3 |
4 | namespace Rampastring.XNAUI;
5 |
6 | ///
7 | /// A class that contains UI-related settings, like default UI colors.
8 | ///
9 | public class UISettings
10 | {
11 | ///
12 | /// The currently active UI settings.
13 | ///
14 | public static UISettings ActiveSettings { get; set; }
15 |
16 | public float TextShadowDistance { get; set; } = 1.0f;
17 | public Color TextShadowColor { get; set; } = Color.Black;
18 |
19 | public Color TextColor { get; set; } = new Color(196, 196, 196);
20 |
21 | public Color SubtleTextColor { get; set; } = Color.Gray;
22 |
23 | public Color AltColor { get; set; } = Color.White;
24 |
25 | public Color ButtonTextColor { get; set; } = new Color(196, 196, 196);
26 |
27 | public Color DisabledItemColor { get; set; } = Color.Gray;
28 |
29 | public Color ButtonHoverColor { get; set; } = Color.White;
30 |
31 | public Color BackgroundColor { get; set; } = Color.Black;
32 |
33 | public Color FocusColor { get; set; } = new Color(64, 64, 64);
34 |
35 | public Color PanelBackgroundColor { get; set; } = new Color(32, 32, 32);
36 |
37 | public Color PanelBorderColor { get; set; } = new Color(196, 196, 196);
38 |
39 | public Texture2D CheckBoxCheckedTexture { get; set; }
40 |
41 | public Texture2D CheckBoxClearTexture { get; set; }
42 |
43 | public Texture2D CheckBoxDisabledCheckedTexture { get; set; }
44 |
45 | public Texture2D CheckBoxDisabledClearTexture { get; set; }
46 |
47 | public Texture2D RatingBoxCheckedTexture { get; set; }
48 |
49 | public Texture2D RatingBoxClearTexture { get; set; }
50 |
51 | public float DefaultAlphaRate = 0.005f;
52 |
53 | public float CheckBoxAlphaRate = 0.05f;
54 |
55 | public float IndicatorAlphaRate = 0.05f;
56 | }
57 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/Callback.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Rampastring.XNAUI.XNAControls;
4 |
5 | ///
6 | /// A callback for storing a delegate and its parameters.
7 | ///
8 | internal class Callback
9 | {
10 | public Callback(Delegate d, object[] args)
11 | {
12 | this.d = d;
13 | this.arguments = args;
14 | }
15 |
16 | private Delegate d;
17 | private object[] arguments;
18 |
19 | public void Invoke()
20 | {
21 | //Logger.Log("Executing callback " + d.Method.Name);
22 | d.DynamicInvoke(arguments);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/ControlDrawMode.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.XNAUI.XNAControls;
2 |
3 | public enum ControlDrawMode
4 | {
5 | ///
6 | /// The control is drawn on the same render target with its parent.
7 | ///
8 | NORMAL,
9 |
10 | ///
11 | /// The control is drawn on its own render target.
12 | ///
13 | UNIQUE_RENDER_TARGET
14 | }
15 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/IControlINIAttributeParser.cs:
--------------------------------------------------------------------------------
1 | using Rampastring.Tools;
2 |
3 | namespace Rampastring.XNAUI.XNAControls;
4 |
5 | ///
6 | /// Provides an interface for an object that can parse
7 | /// and apply custom INI attributes for controls.
8 | ///
9 | public interface IControlINIAttributeParser
10 | {
11 | ///
12 | /// Attempts to parse given key's value and sets the parameter value for the given control.
13 | ///
14 | /// The control that the parsing happens for currently.
15 | /// The INI file that is being read from.
16 | /// The key that is being read.
17 | /// The key's value.
18 | /// Whether the parsing was succesful.
19 | bool ParseINIAttribute(XNAControl control, IniFile iniFile, string key, string value);
20 | }
21 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/MouseEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using System;
3 |
4 | namespace Rampastring.XNAUI.XNAControls;
5 |
6 | public class MouseEventArgs : EventArgs
7 | {
8 | public MouseEventArgs(Point relativeLocation)
9 | {
10 | RelativeLocation = relativeLocation;
11 | }
12 |
13 | ///
14 | /// The point of the mouse cursor relative to the control.
15 | ///
16 | public Point RelativeLocation { get; set; }
17 | }
18 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/XNAControl.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Rampastring.XNAUI/XNAControls/XNAControl.cs
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/XNADropDownItem.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using Microsoft.Xna.Framework.Graphics;
3 |
4 | namespace Rampastring.XNAUI.XNAControls;
5 |
6 | ///
7 | /// A drop-down / context menu item.
8 | ///
9 | public class XNADropDownItem
10 | {
11 | public Color? TextColor { get; set; }
12 |
13 | public Texture2D Texture { get; set; }
14 |
15 | public string Text { get; set; }
16 |
17 | ///
18 | /// An object for containing custom info in the drop down item.
19 | ///
20 | public object Tag { get; set; }
21 | public bool Selectable { get; set; } = true;
22 |
23 | private float alpha = 1.0f;
24 | public float Alpha
25 | {
26 | get { return alpha; }
27 | set
28 | {
29 | if (value < 0.0f)
30 | alpha = 0.0f;
31 | else if (value > 1.0f)
32 | alpha = 1.0f;
33 | else
34 | alpha = value;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/XNAPasswordBox.cs:
--------------------------------------------------------------------------------
1 | namespace Rampastring.XNAUI.XNAControls;
2 |
3 | ///
4 | /// A text box that displays its characters as a different character
5 | /// (a star by default), regardless of what the characters actually are.
6 | /// In other words, a text box for inputting passwords.
7 | ///
8 | public class XNAPasswordBox : XNATextBox
9 | {
10 | ///
11 | /// The character that is displayed in place of all other characters.
12 | ///
13 | public char VisibleChar { get; set; }
14 |
15 | ///
16 | /// Creates a new XNAPasswordBox.
17 | ///
18 | /// The WindowManager.
19 | public XNAPasswordBox(WindowManager wm) : base(wm)
20 | {
21 | VisibleChar = '*';
22 | }
23 |
24 | ///
25 | /// Gets or sets the real text of the password box.
26 | ///
27 | public string Password
28 | {
29 | get
30 | {
31 | return base.Text;
32 | }
33 | set
34 | {
35 | Text = value;
36 | }
37 | }
38 |
39 | ///
40 | /// Gets the visible string of the password box.
41 | /// If set, changes the actual text / password in the box.
42 | ///
43 | public override string Text
44 | {
45 | get
46 | {
47 | return new string(VisibleChar, base.Text.Length);
48 | }
49 |
50 | set
51 | {
52 | base.Text = value;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/XNASuggestionTextBox.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using Microsoft.Xna.Framework;
3 | using Rampastring.Tools;
4 |
5 | namespace Rampastring.XNAUI.XNAControls;
6 |
7 | ///
8 | /// A text box that displays a "suggestion" text when it's not active.
9 | ///
10 | public class XNASuggestionTextBox : XNATextBox
11 | {
12 | public XNASuggestionTextBox(WindowManager windowManager) : base(windowManager)
13 | {
14 | }
15 |
16 | public string Suggestion { get; set; }
17 |
18 | private Color? _suggestedTextColor;
19 |
20 | public Color SuggestedTextColor
21 | {
22 | get => _suggestedTextColor ?? UISettings.ActiveSettings.SubtleTextColor;
23 | set => _suggestedTextColor = value;
24 | }
25 |
26 | public override void Initialize()
27 | {
28 | base.Initialize();
29 |
30 | Text = Suggestion ?? string.Empty;
31 | }
32 |
33 | public override void ParseControlINIAttribute(IniFile iniFile, string key, string value)
34 | {
35 | if (key == "Suggestion")
36 | {
37 | Suggestion = value;
38 | }
39 |
40 | base.ParseControlINIAttribute(iniFile, key, value);
41 | }
42 |
43 | public override Color TextColor
44 | {
45 | get => WindowManager.SelectedControl == this ? base.TextColor : SuggestedTextColor;
46 | set => base.TextColor = value;
47 | }
48 |
49 | public override void OnSelectedChanged()
50 | {
51 | base.OnSelectedChanged();
52 |
53 | if (WindowManager.SelectedControl == this)
54 | {
55 | if (Text == Suggestion)
56 | Text = string.Empty;
57 | }
58 | else
59 | {
60 | if (string.IsNullOrEmpty(Text))
61 | Text = Suggestion ?? string.Empty;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Rampastring.XNAUI/XNAControls/XNATextBlock.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using Rampastring.Tools;
3 |
4 | namespace Rampastring.XNAUI.XNAControls;
5 |
6 | ///
7 | /// A panel with text.
8 | ///
9 | public class XNATextBlock : XNAPanel
10 | {
11 | public XNATextBlock(WindowManager windowManager) : base(windowManager)
12 | {
13 | }
14 |
15 | public override string Text
16 | {
17 | get
18 | {
19 | return base.Text;
20 | }
21 |
22 | set
23 | {
24 | base.Text = Renderer.FixText(value, FontIndex, Width - TextXMargin * 2).Text;
25 | }
26 | }
27 |
28 | private Color? _textColor;
29 |
30 | public Color TextColor
31 | {
32 | get
33 | {
34 | if (_textColor.HasValue)
35 | return _textColor.Value;
36 |
37 | return UISettings.ActiveSettings.TextColor;
38 | }
39 | set { _textColor = value; }
40 | }
41 |
42 | public int FontIndex { get; set; }
43 |
44 | public int TextXMargin { get; set; } = 3;
45 |
46 | public int TextYPosition { get; set; } = 3;
47 |
48 | public override void ParseControlINIAttribute(IniFile iniFile, string key, string value)
49 | {
50 | switch (key)
51 | {
52 | case "TextColor":
53 | TextColor = AssetLoader.GetColorFromString(value);
54 | return;
55 | }
56 |
57 | base.ParseControlINIAttribute(iniFile, key, value);
58 | }
59 |
60 | public override void Draw(GameTime gameTime)
61 | {
62 | DrawPanel();
63 |
64 | if (!string.IsNullOrEmpty(Text))
65 | {
66 | DrawStringWithShadow(Text, FontIndex,
67 | new Vector2(TextXMargin, TextYPosition), TextColor);
68 | }
69 |
70 | if (DrawBorders)
71 | DrawPanelBorders();
72 |
73 | DrawChildren(gameTime);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/RandomMapGenerator/AbstractMapMember.cs:
--------------------------------------------------------------------------------
1 | using RandomMapGenerator.TileInfo;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace RandomMapGenerator
8 | {
9 | public class AbstractMapMember
10 | {
11 | public string MapUnitName { get; set; } = "empty";
12 | public bool IsOnMap { get; set; } = false;
13 | public bool Placed { get; set; } = false;
14 | public bool NWConnected { get; set; } = false;
15 | public bool NEConnected { get; set; } = false;
16 | public bool SEConnected { get; set; } = false;
17 | public bool SWConnected { get; set; } = false;
18 | public int Entropy { get; set; } = 50;
19 | public bool IsAllOnVisibleMap { get; set; } = false;
20 | public bool PlayerLocationHasTiberium { get; set; } = false;
21 | public AbstractMapUnit GetAbstractMapUnit()
22 | {
23 | var absMapUnit = new AbstractMapUnit();
24 | foreach (var pAbsMapUnit in WorkingMap.AbstractMapUnitList)
25 | {
26 | if (MapUnitName == pAbsMapUnit.MapUnitName)
27 | {
28 | absMapUnit = pAbsMapUnit;
29 | }
30 | }
31 | return absMapUnit;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/RandomMapGenerator/Constants.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator
7 | {
8 | static class Constants
9 | {
10 | public readonly static string ProgramFolder = Path.Combine(Environment.CurrentDirectory, "Resources\\RandomMapGenerator_RA2\\");
11 | public static string FileName = "map.yrm";
12 | public static string SaveFileName = "Output.txt";
13 | public static string MapPackName = "IsoMapPack5";
14 | public static string FilePath = ProgramFolder + FileName;
15 | public static string SaveFilePath = ProgramFolder + SaveFileName;
16 | public static string BitMapName = "bitmap.bmp";
17 | public static string BitMapPath = ProgramFolder + BitMapName;
18 | public static string TemplateMapName = "templateMap.map";
19 | public static string TemplateMapPath = ProgramFolder + TemplateMapName;
20 | public static string TEMPERATEPath = ProgramFolder + @"TileInfo\TEMPERATE\";
21 | public static string SNOWPath = ProgramFolder + @"TileInfo\SNOW\";
22 | public static string URBANPath = ProgramFolder + @"TileInfo\URBAN\";
23 | public static string NEWURBANPath = ProgramFolder + @"TileInfo\NEWURBAN\";
24 | public static string LUNARPath = ProgramFolder + @"TileInfo\LUNAR\";
25 | public static string DESERTPath = ProgramFolder + @"TileInfo\DESERT\";
26 |
27 | public static int FailureTimes = 10000;
28 | public static string RenderPath = ProgramFolder + @"Map Renderer\CNCMaps.Renderer.exe";
29 | public static string GamePath = @"D:\Games\YURI\Red Alert 2";
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/RandomMapGenerator/NonTileObjects/Aircraft.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator.NonTileObjects
7 | {
8 | public class Aircraft
9 | {
10 | public string Owner;
11 | public string Name;
12 | public int Strength;
13 | public int RelativeX;
14 | public int X;
15 | public int RelativeY;
16 | public int Y;
17 | public int Direction;
18 | public string State;
19 | public string Tag;
20 | public int Veteran;
21 | public int Group;
22 | public int AutocreateNoRecruitable;
23 | public int AutocreateYesRecruitable;
24 |
25 | public void Initialize(string iniValue)
26 | {
27 | string[] values = iniValue.Split(',');
28 | if (values.Count() == 12)
29 | {
30 | Owner = values[0];
31 | Name = values[1];
32 | Strength = int.Parse(values[2]);
33 | RelativeX = int.Parse(values[3]) - WorkingMap.StartingX;
34 | RelativeY = int.Parse(values[4]) - WorkingMap.StartingY;
35 | Direction = int.Parse(values[5]);
36 | State = values[6];
37 | Tag = values[7];
38 | Veteran = int.Parse(values[8]);
39 | Group = int.Parse(values[9]);
40 | AutocreateNoRecruitable = int.Parse(values[10]);
41 | AutocreateYesRecruitable = int.Parse(values[11]);
42 | }
43 | else
44 | Console.WriteLine("An infantry cannot be parsed.");
45 | }
46 | public Aircraft Clone()
47 | {
48 | return (Aircraft)this.MemberwiseClone();
49 | }
50 | public string CreateINIValue()
51 | {
52 | return Owner + "," + Name + "," + Strength + "," + X + "," + Y + "," + Direction + "," + State + "," + Tag
53 | + "," + Veteran + "," + Group + "," + AutocreateNoRecruitable + "," + AutocreateYesRecruitable;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/RandomMapGenerator/NonTileObjects/Smudge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator.NonTileObjects
7 | {
8 | public class Smudge
9 | {
10 | public string Name;
11 | public int RelativeX;
12 | public int X;
13 | public int RelativeY;
14 | public int Y;
15 | public int unknown;
16 |
17 | public void Initialize(string iniValue)
18 | {
19 | string[] values = iniValue.Split(',');
20 | if (values.Count() == 4)
21 | {
22 | Name = values[0];
23 | RelativeX = int.Parse(values[1]) - WorkingMap.StartingX;
24 | RelativeY = int.Parse(values[2]) - WorkingMap.StartingY;
25 | unknown = int.Parse(values[3]);
26 | }
27 | }
28 | public Smudge Clone()
29 | {
30 | return (Smudge)this.MemberwiseClone();
31 | }
32 | public string CreateINIValue()
33 | {
34 | return Name + "," + X + "," + Y + "," + unknown;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/RandomMapGenerator/NonTileObjects/Terrain.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator.NonTileObjects
7 | {
8 | public class Terrain
9 | {
10 | public int RelativeX;
11 | public int X;
12 | public int RelativeY;
13 | public int Y;
14 | public string Name;
15 |
16 | public void Initialize(KeyValuePair iniLine)
17 | {
18 | string key = iniLine.Key;
19 | int length = key.Length;
20 | string x = key.Substring(key.Length - 3, 3);
21 | string y = key.Substring(0, key.Length - 3);
22 | Name = iniLine.Value;
23 | RelativeX = int.Parse(x) - WorkingMap.StartingX;
24 | RelativeY = int.Parse(y) - WorkingMap.StartingY;
25 | }
26 | public Terrain Clone()
27 | {
28 | return (Terrain)this.MemberwiseClone();
29 | }
30 | public KeyValuePair CreateINILine()
31 | {
32 | string key = Y.ToString() + string.Format("{0:000}", X);
33 | var iniLine = new KeyValuePair(key, Name);
34 | return iniLine;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/RandomMapGenerator/NonTileObjects/Waypoint.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator.NonTileObjects
7 | {
8 | public class Waypoint
9 | {
10 | public int RelativeX;
11 | public int X;
12 | public int RelativeY;
13 | public int Y;
14 | public int Index;
15 |
16 | public void Initialize(KeyValuePair iniLine)
17 | {
18 | string value = iniLine.Value;
19 | int length = value.Length;
20 | string x = value.Substring(value.Length - 3, 3);
21 | string y = value.Substring(0, value.Length - 3);
22 | Index = int.Parse(iniLine.Key);
23 | RelativeX = int.Parse(x) - WorkingMap.StartingX;
24 | RelativeY = int.Parse(y) - WorkingMap.StartingY;
25 | }
26 | public Waypoint Clone()
27 | {
28 | return (Waypoint)this.MemberwiseClone();
29 | }
30 | public KeyValuePair CreateINILine()
31 | {
32 | string value = Y.ToString() + string.Format("{0:000}", X);
33 | var iniLine = new KeyValuePair(Index.ToString(),value);
34 | return iniLine;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/RandomMapGenerator/RandomMapGenerator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Library
5 | net6.0-windows7.0
6 | 13.0
7 | enable
8 | disable
9 | true
10 |
11 |
12 |
13 | ..\Bin\Resources\Binaries\
14 |
15 |
16 | ..\Bin\Resources\Binaries\
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/RandomMapGenerator/RandomMapGenerator.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.10.35027.167
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RandomMapGenerator", "RandomMapGenerator.csproj", "{DA3063BB-1B23-4960-843C-55875DC2895C}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {DA3063BB-1B23-4960-843C-55875DC2895C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {DA3063BB-1B23-4960-843C-55875DC2895C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {DA3063BB-1B23-4960-843C-55875DC2895C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {DA3063BB-1B23-4960-843C-55875DC2895C}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {EECFA64B-748D-4C62-8467-A2CB11225C19}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/RandomMapGenerator/Tile/AbstractTileType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator.TileInfo
7 | {
8 | public class AbstractTileType
9 | {
10 | public int TileNum { get; set; }
11 | public int SubTile { get; set; }
12 | public int Z { get; set; }
13 | public bool Used { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/RandomMapGenerator/Tile/FailureAbstractMapUnitRecord.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator.TileInfo
7 | {
8 | public class FailureAbstractMapUnitRecord
9 | {
10 | public int X;
11 | public int Y;
12 | public List Name = new List();
13 |
14 | public void AddFailureRecord(int x, int y, string name)
15 | {
16 | X = x;
17 | Y = y;
18 | Name.Add(name);
19 | }
20 | public bool IsTargetFailureRecord(int x, int y)
21 | {
22 | if (x == X && y == Y)
23 | return true;
24 | else
25 | return false;
26 | }
27 | //units with the same connection type
28 | public bool IsInFailureRecord(string name)
29 | {
30 | var targetMU = WorkingMap.GetAbstractMapUnitByName(name);
31 | foreach (var n in Name)
32 | {
33 | var thisMU = WorkingMap.GetAbstractMapUnitByName(n);
34 | if (targetMU.NEConnectionType == thisMU.NEConnectionType
35 | && targetMU.SEConnectionType == thisMU.SEConnectionType
36 | && targetMU.NWConnectionType == thisMU.NWConnectionType
37 | && targetMU.SWConnectionType == thisMU.SWConnectionType)
38 | return true;
39 | }
40 | return false;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/RandomMapGenerator/Tile/TileEnum.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RandomMapGenerator.TileInfo
7 | {
8 | public enum Theater
9 | {
10 | TEMPERATE = 0,
11 | SNOW = 1,
12 | URBAN = 2,
13 | NEWURBAN = 3,
14 | LUNAR = 4,
15 | DESERT = 5
16 | }
17 | enum Common
18 | {
19 | _000_Empty = -1,
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Reunion/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Reunion/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Reunion")]
9 | [assembly: AssemblyDescription("重聚未来客户端启动器")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Reunion Client Launcher Ciallo~ (∠・ω< )⌒★")]
13 | [assembly: AssemblyCopyright("Copyright © Snowy Studio 2022-2025")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("60c4767f-c794-4a30-90bb-3d36674f2bac")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | [assembly: AssemblyVersion("1.5.1.0")]
33 | [assembly: AssemblyFileVersion("1.5.1.0")]
34 | [assembly: AssemblyInformationalVersion("1.5.1-beta")]
--------------------------------------------------------------------------------
/Reunion/clienticon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/Reunion/clienticon.ico
--------------------------------------------------------------------------------
/cncnetchatlobby.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/cncnetchatlobby.png
--------------------------------------------------------------------------------
/cncnetgamelobby.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Snowy-Studio/RF-Client/449ce4fd7f3e223a853086f0243d08c83f062f2a/cncnetgamelobby.png
--------------------------------------------------------------------------------