-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
12 changed files
with
776 additions
and
189 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,93 @@ | ||
using System.IO; | ||
using G2DataGUI.Common.Data.Common; | ||
using G2DataGUI.IO.Streams; | ||
|
||
namespace G2DataGUI.Common.Data.Maps; | ||
public class MapScript | ||
{ | ||
// used for UI list | ||
public int Index { get; set; } | ||
|
||
public byte[] Unknown1 { get; set; } | ||
public Vector3 Offset { get; set; } = new(); | ||
public float Direction { get; set; } | ||
public byte TransitionEffect { get; set; } | ||
public byte Unknown2 { get; set; } | ||
public byte Unknown3 { get; set; } | ||
public byte Unknown4 { get; set; } | ||
public short MapID { get; set; } | ||
public short Unknown5 { get; set; } | ||
public byte Unknown6 { get; set; } | ||
public byte Unknown7 { get; set; } | ||
public short Unknown8 { get; set; } | ||
public byte Unknown9 { get; set; } | ||
public byte Unknown10 { get; set; } | ||
public byte Unknown11 { get; set; } | ||
public byte Unknown12 { get; set; } | ||
public byte Unknown13 { get; set; } | ||
public byte Unknown14 { get; set; } | ||
public byte Unknown15 { get; set; } | ||
public byte Unknown16 { get; set; } | ||
public byte Unknown17 { get; set; } | ||
public byte[] Unknown18 { get; set; } | ||
|
||
public static uint Unknown1Length => 40; | ||
public static uint Unknown18Length => 15; | ||
|
||
public static MapScript ReadMapScript(Stream reader, int index) | ||
{ | ||
MapScript mapScript = new() | ||
{ | ||
Index = index, | ||
Unknown1 = reader.ReadRawByteArray(Unknown1Length), | ||
Offset = Vector3.ReadVector3(reader), | ||
Direction = reader.ReadRawFloat(), | ||
TransitionEffect = reader.ReadRawByte(), | ||
Unknown2 = reader.ReadRawByte(), | ||
Unknown3 = reader.ReadRawByte(), | ||
Unknown4 = reader.ReadRawByte(), | ||
MapID = reader.ReadRawShort(), | ||
Unknown5 = reader.ReadRawShort(), | ||
Unknown6 = reader.ReadRawByte(), | ||
Unknown7 = reader.ReadRawByte(), | ||
Unknown8 = reader.ReadRawShort(), | ||
Unknown9 = reader.ReadRawByte(), | ||
Unknown10 = reader.ReadRawByte(), | ||
Unknown11 = reader.ReadRawByte(), | ||
Unknown12 = reader.ReadRawByte(), | ||
Unknown13 = reader.ReadRawByte(), | ||
Unknown14 = reader.ReadRawByte(), | ||
Unknown15 = reader.ReadRawByte(), | ||
Unknown16 = reader.ReadRawByte(), | ||
Unknown17 = reader.ReadRawByte(), | ||
Unknown18 = reader.ReadRawByteArray(Unknown18Length), | ||
}; | ||
return mapScript; | ||
} | ||
|
||
public void WriteMapScript(Stream writer) | ||
{ | ||
writer.WriteRawByteArray(Unknown1); | ||
Offset.WriteVector3(writer); | ||
writer.WriteRawFloat(Direction); | ||
writer.WriteRawByte(TransitionEffect); | ||
writer.WriteRawByte(Unknown2); | ||
writer.WriteRawByte(Unknown3); | ||
writer.WriteRawByte(Unknown4); | ||
writer.WriteRawShort(MapID); | ||
writer.WriteRawShort(Unknown5); | ||
writer.WriteRawByte(Unknown6); | ||
writer.WriteRawByte(Unknown7); | ||
writer.WriteRawShort(Unknown8); | ||
writer.WriteRawByte(Unknown9); | ||
writer.WriteRawByte(Unknown10); | ||
writer.WriteRawByte(Unknown11); | ||
writer.WriteRawByte(Unknown12); | ||
writer.WriteRawByte(Unknown13); | ||
writer.WriteRawByte(Unknown14); | ||
writer.WriteRawByte(Unknown15); | ||
writer.WriteRawByte(Unknown16); | ||
writer.WriteRawByte(Unknown17); | ||
writer.WriteRawByteArray(Unknown18); | ||
} | ||
} |
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,64 @@ | ||
using System.Collections.Generic; | ||
using G2DataGUI.Common.Data.Maps; | ||
using G2DataGUI.UI.Common.ViewModels; | ||
|
||
namespace G2DataGUI.UI.ViewModels; | ||
|
||
public class MapScriptsViewModel : BaseViewModel | ||
{ | ||
private List<MapScript> _selectedMapScripts = new(); | ||
private int _selectedMapScriptIndex; | ||
private MapScript _selectedMapScriptItem; | ||
|
||
public static MapScriptsViewModel Instance { get; private set; } = new(); | ||
|
||
private MapScriptsViewModel() | ||
{ | ||
|
||
} | ||
|
||
public List<MapScript> SelectedMapScripts | ||
{ | ||
get => _selectedMapScripts; | ||
set | ||
{ | ||
_selectedMapScripts = value == null ? new List<MapScript>() : value; | ||
SelectedMapScriptIndex = 0; | ||
OnPropertyChanged(nameof(SelectedMapScripts)); | ||
OnPropertyChanged(nameof(HasMapScripts)); | ||
OnPropertyChanged(nameof(SelectedMapScriptIndex)); | ||
} | ||
} | ||
|
||
public bool HasMapScripts => SelectedMapScripts.Count > 0; | ||
|
||
public int SelectedMapScriptIndex | ||
{ | ||
get => _selectedMapScriptIndex; | ||
set | ||
{ | ||
if (value < 0) | ||
{ | ||
value = 0; | ||
} | ||
|
||
if (value >= SelectedMapScripts.Count) | ||
{ | ||
return; | ||
} | ||
|
||
_selectedMapScriptIndex = value; | ||
SelectedMapScriptItem = SelectedMapScripts[value]; | ||
} | ||
} | ||
|
||
public MapScript SelectedMapScriptItem | ||
{ | ||
get => _selectedMapScriptItem; | ||
set | ||
{ | ||
_selectedMapScriptItem = value; | ||
OnPropertyChanged(nameof(SelectedMapScriptItem)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.