Skip to content

Commit

Permalink
Merge pull request #4 from TieHaxJan/master
Browse files Browse the repository at this point in the history
Merge TieHaxJan/Brick-Force with v1.4.0
  • Loading branch information
TieHaxJan authored Jan 7, 2025
2 parents 2268650 + 0a99a09 commit 81a2ee4
Show file tree
Hide file tree
Showing 81 changed files with 8,325 additions and 2,848 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vs/
67 changes: 41 additions & 26 deletions Assembly-CSharp/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<OutputType>Library</OutputType>
<LangVersion>7.3</LangVersion>
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -27,6 +28,9 @@
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<OutputPath>..\..\BfLauncher\BrickForce_Data\Managed\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Brick-Force\BrickForce_Data\Managed\</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -726,6 +730,15 @@
<Compile Include="_Emulator\Core.cs" />
<Compile Include="_Emulator\GUI\MainGUI.cs" />
<Compile Include="_Emulator\GUI\DebugConsole.cs" />
<Compile Include="_Emulator\JSON\JsonObject.cs" />
<Compile Include="_Emulator\JSON\JsonReader.cs" />
<Compile Include="_Emulator\JSON\JsonWriter.cs" />
<Compile Include="_Emulator\Maps\MapGenerator.cs" />
<Compile Include="_Emulator\Network\ChannelManager.cs" />
<Compile Include="_Emulator\Network\ChannelReference.cs" />
<Compile Include="_Emulator\Network\ChunkedBuffer.cs" />
<Compile Include="_Emulator\Network\PlayerInfo.cs" />
<Compile Include="_Emulator\Network\ShopEmulator.cs" />
<Compile Include="_Emulator\Network\ClientExtension.cs" />
<Compile Include="_Emulator\Network\ClientReference.cs" />
<Compile Include="_Emulator\Network\ExtensionOpcodes.cs" />
Expand All @@ -736,50 +749,52 @@
<Compile Include="_Emulator\Network\DummyData.cs" />
<Compile Include="_Emulator\Network\ServerEmulator.cs" />
<Compile Include="_Emulator\Network\SlotData.cs" />
<Compile Include="_Emulator\Utils\CRC32.cs" />
<Compile Include="_Emulator\Utils\Utils.cs" />
<Compile Include="_Emulator\Utils\Hook.cs" />
<Compile Include="_Emulator\Utils\Import.cs" />
<Compile Include="_Emulator\Utils\Zip.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Assembly-CSharp-firstpass.dll</HintPath>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-UnityScript, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Assembly-UnityScript.dll</HintPath>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-UnityScript-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Assembly-UnityScript-firstpass.dll</HintPath>
<Reference Include="Assembly-UnityScript-firstpass">
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\Assembly-UnityScript-firstpass.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang, Version=2.0.9.5, Culture=neutral, PublicKeyToken=32c39770e9a21a67, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Boo.Lang.dll</HintPath>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\..\BfLauncher\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Mono.Security, Version=2.0.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Mono.Security.dll</HintPath>
<Reference Include="Mono.Security">
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>bin\Debug\System.dll</HintPath>
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\System.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>bin\Debug\System.Core.dll</HintPath>
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\System.Core.dll</HintPath>
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Brick-Force\BrickForce_Data\Managed\UnityEngine.dll</HintPath>
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityScript.Lang, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\UnityScript.Lang.dll</HintPath>
<Reference Include="UnityScript.Lang">
<HintPath>..\..\..\Brick-Force-1.1.0\Brick-Force\BrickForce_Data\Managed\UnityScript.Lang.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="_Emulator\DATA\shop.txt" />
<EmbeddedResource Include="_Emulator\DATA\shopCategory.txt" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy /Y "$(TargetPath)" "G:\bf rewrite\Brick-Force 2\BrickForce_Data\Managed\Assembly-CSharp.dll"
copy /Y "$(TargetPath)" "G:\bf rewrite\Brick-Force 3\BrickForce_Data\Managed\Assembly-CSharp.dll"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
15 changes: 12 additions & 3 deletions Assembly-CSharp/BackConfirmDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,18 @@ public override bool DoDialog()
if (GlobalVars.Instance.MyButton(new Rect(GlobalVars.Instance.ScreenRect.width / 2f - 110f, size.y - sizeOk.y - 25f, sizeOk.x, sizeOk.y), StringMgr.Instance.Get("SAVE"), "BtnAction") || GlobalVars.Instance.IsReturnPressed())
{
result = true;
GetCopyRight();
ThumbnailToPNG();
CSNetManager.Instance.Sock.SendCS_SAVE_REQ(umi.Slot, ThumbnailToPNG());

bool copy = GetCopyRight();
ThumbnailToPNG();
//if umi does not exist, its a new map
if (copy)
{
CSNetManager.Instance.Sock.SendCS_SAVE_REQ(umi.Slot, ThumbnailToPNG());
} else
{
CSNetManager.Instance.Sock.SendCS_SAVE_REQ(0, ThumbnailToPNG());
}
//CSNetManager.Instance.Sock.SendCS_SAVE_REQ(umi.Slot, ThumbnailToPNG());
BackToScene();
}
if (GlobalVars.Instance.MyButton(new Rect(GlobalVars.Instance.ScreenRect.width / 2f + 10f, size.y - sizeOk.y - 25f, sizeOk.x, sizeOk.y), StringMgr.Instance.Get("CANCEL"), "BtnAction") || GlobalVars.Instance.IsReturnPressed())
Expand Down
14 changes: 11 additions & 3 deletions Assembly-CSharp/BndMatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,17 @@ private void Start()
private void StartLoad()
{
GC.Collect();
BrickManager.Instance.userMap = new UserMap();
CSNetManager.Instance.Sock.SendCS_CACHE_BRICK_REQ();
}
UserMap userMap = new UserMap();
if (userMap.Load(RoomManager.Instance.CurMap))
{
BrickManager.Instance.userMap = userMap;
}
else
{
BrickManager.Instance.userMap = new UserMap();
CSNetManager.Instance.Sock.SendCS_CACHE_BRICK_REQ();
}
}

private void ResetGameStuff()
{
Expand Down
25 changes: 17 additions & 8 deletions Assembly-CSharp/BndTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ public bool IsBuildPhase

public static int PackTimerOption(int build, int battle, int rpt)
{
build /= 60;
build /= 60;
battle /= 60;
return (build << 16) | (battle << 8) | rpt;
}
return (build << 16) | (battle << 8) | rpt;
//TESTING: return (1 << 16) | (1 << 8) | 2;
}

public static int BuildPhaseTime(int timerOpt)
{
Expand All @@ -73,10 +74,13 @@ public void ResetTimer()

public void ShiftPhase(bool buildPhase)
{
if (buildPhase)
Debug.LogWarning("BndTimer: ShiftPhase to isBuildPhase: " + buildPhase);
if (buildPhase)
{
repeat--;
}
Debug.LogWarning("BndTimer: reduce repeat: " + repeat);
repeat--;
Debug.LogWarning("BndTimer: new repeat: " + repeat);
}
isBuildPhase = buildPhase;
remain = ((!isBuildPhase) ? BattlePhaseTime(RoomManager.Instance.TimeLimit) : BuildPhaseTime(RoomManager.Instance.TimeLimit));
}
Expand All @@ -88,6 +92,7 @@ private void Start()
isBuildPhase = true;
remain = BuildPhaseTime(RoomManager.Instance.TimeLimit);
repeat = Repeat(RoomManager.Instance.TimeLimit);
Debug.LogWarning("repeatAtStart of BNDTimer: " + repeat);
GameObject gameObject = GameObject.Find("Me");
if (null == gameObject)
{
Expand Down Expand Up @@ -142,13 +147,17 @@ private void Update()
play++;
if (play % 60 == 0)
{

CSNetManager.Instance.Sock.SendCS_STACK_POINT_REQ();
}
//Debug.Log("[VERBOSE] BndTimerUpdate: remain: " + remain);
if (remain < 0)
{
remain = 0;
ShiftPhase(!isBuildPhase);
CSNetManager.Instance.Sock.SendCS_BND_SHIFT_PHASE_REQ(repeat, isBuildPhase);
Debug.LogWarning("BndTimer: ShiftPhase from isBuildPhase: " + isBuildPhase);
ShiftPhase(!isBuildPhase);
Debug.LogWarning("BndTimer: SendShiftPhaseReq repeat: " + repeat + " isBuildPhase: " + isBuildPhase);
CSNetManager.Instance.Sock.SendCS_BND_SHIFT_PHASE_REQ(repeat, isBuildPhase);
}
else
{
Expand Down
51 changes: 49 additions & 2 deletions Assembly-CSharp/CSVLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,53 @@ private void _SecuredLoadFromBinaryReader(BinaryReader reader)
_noCols = num2;
}

public bool SecuredLoad(string pathName)
public void SecuredLoadAndSave(String pathName, String targetPath)
{
SecuredLoad(pathName);
File.WriteAllText(targetPath, "");
FileStream fileStream = File.Open(targetPath, FileMode.Create, FileAccess.Write);
StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.ASCII);
streamWriter.BaseStream.Seek(0L, SeekOrigin.Begin);
streamWriter.WriteLine(_rows.Count);
for (int i = 0; i < _rows.Count; i++)
{
string line = "";
string[] array = _rows[i];
for (int j = 0; j < array.Length; j++)
{
if(j == array.Length - 1)
{
line += array[j];
} else {
line += array[j] + ",";
}

}
streamWriter.WriteLine(line);
}
streamWriter.Close();
fileStream.Close();
}

public void LoadAndSecuredSave(String pathName, String targetPath)
{
FileStream fileStream = File.OpenRead(pathName);
StreamReader streamReader = new StreamReader(fileStream, Encoding.ASCII);
_rows = new List<string[]>();
streamReader.BaseStream.Seek(0L, SeekOrigin.Begin);
int num = Int32.Parse(streamReader.ReadLine());
for (int i = 0; i < _rows.Count; i++)
{
string text = streamReader.ReadLine();
string[] array = text.Split(',');
_rows.Add(array);
}
streamReader.Close();
fileStream.Close();
SecuredSave(targetPath);
}

public bool SecuredLoad(string pathName)
{
pathName += ".cooked";
try
Expand Down Expand Up @@ -322,7 +368,8 @@ public bool Save(string pathName, string header = "x\tCode")
FileStream fileStream = File.Open(pathName, FileMode.Create, FileAccess.Write);
StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.ASCII);
streamWriter.BaseStream.Seek(0L, SeekOrigin.Begin);
streamWriter.WriteLine(header);
if (header != "")
streamWriter.WriteLine(header);
for (int row = 0; row < Rows; row++)
{
string rowString = "";
Expand Down
1 change: 1 addition & 0 deletions Assembly-CSharp/CaptureTheFlagMatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ private void OnPicked(int seq)
else
{
GameObject gameObject = BrickManManager.Instance.Get(seq);
Debug.Log(gameObject);
if (gameObject != null)
{
Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>();
Expand Down
44 changes: 36 additions & 8 deletions Assembly-CSharp/CreateRoomDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public class CreateRoomDialog : Dialog

private Color txtMainClr = Color.white;

private byte umiSlot;
private int umiSlot;

private bool[] IsSupportClanMode;

Expand Down Expand Up @@ -569,7 +569,7 @@ public bool InitDialog4TeamMatch(int map, ushort modeMask)
return true;
}

public bool InitDialog4MapEditorNew(byte slot)
public bool InitDialog4MapEditorNew(int slot)
{
curModeMask = 32767;
InitDialog();
Expand All @@ -586,7 +586,7 @@ public bool InitDialog4MapEditorNew(byte slot)
return true;
}

public bool InitDialog4MapEditorLoad(byte slot)
public bool InitDialog4MapEditorLoad(int slot)
{
curModeMask = 32767;
InitDialog();
Expand Down Expand Up @@ -2065,16 +2065,44 @@ private bool DoCreator()
viewRect.height += crdMapOffset.y * (float)(num - 1);
}
umiScrollPosition = GUI.BeginScrollView(crdUserMapRect, umiScrollPosition, viewRect);
for (int i = 0; i < num; i++)
for (int i = 0; i < num; i++)
{
for (int j = 0; j < 3; j++)
{
int num2 = 3 * i + j;
if (num2 < umi.Length)
if (num2 < umi.Length)
{
Texture2D texture2D = null;
texture2D = ((umi[num2].Alias.Length <= 0) ? emptySlot : ((!(umi[num2].Thumbnail == null)) ? umi[num2].Thumbnail : nonAvailable));
Rect rect = new Rect((float)j * (crdMapSize.x + crdMapOffset.x), (float)i * (crdMapSize.y + crdMapOffset.y), crdMapSize.x, crdMapSize.y);
Texture2D texture2D = emptySlot;
//wrapped with try catch to catch that anoying nullpointer, this gets called like every frame but atleast the map loads
try
{
if (umi[num2] == null || num2 == 0)
{
texture2D = emptySlot;
}
else
{
if (umi[num2].Alias.Length <= 0 || umi[num2].regMap.Alias.Length <= 0)
{
texture2D = emptySlot;
}
else
{
texture2D = umi[num2].Thumbnail;
}

if (texture2D == null)
{
texture2D = nonAvailable;
}
}
}
catch (NullReferenceException ex)
{
Debug.LogError($"NullReferenceException encountered: {ex.Message}");
texture2D = nonAvailable; // Assign a default value to ensure stability
}
Rect rect = new Rect((float)j * (crdMapSize.x + crdMapOffset.x), (float)i * (crdMapSize.y + crdMapOffset.y), crdMapSize.x, crdMapSize.y);
Rect position = new Rect(rect.x, rect.y, rect.width, rect.width);
TextureUtil.DrawTexture(position, texture2D, ScaleMode.StretchToFill);
if (GlobalVars.Instance.MyButton(rect, string.Empty, (!umi[num2].IsPremium) ? "BoxMapSelectBorder" : "BoxMapSelectBorderPremium") && (!umi[num2].IsPremium || flag))
Expand Down
Loading

0 comments on commit 81a2ee4

Please sign in to comment.