-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add particle system parameter selection interface for trigger actions
- Loading branch information
1 parent
7fd1d5c
commit 03e678e
Showing
9 changed files
with
141 additions
and
3 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
35 changes: 35 additions & 0 deletions
35
src/TSMapEditor/Config/UI/Windows/SelectParticleSystemTypeWindow.ini
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,35 @@ | ||
[SelectParticleSystemTypeWindow] | ||
$Width=250 | ||
$Height=RESOLUTION_HEIGHT - 100 | ||
$CC0=lblDescription:XNALabel | ||
$CC1=tbSearch:EditorSuggestionTextBox | ||
$CC2=btnSelect:EditorButton | ||
$CC3=lbObjectList:EditorListBox | ||
HasCloseButton=true | ||
|
||
|
||
[lblDescription] | ||
$X=EMPTY_SPACE_SIDES | ||
$Y=EMPTY_SPACE_TOP | ||
FontIndex=1 | ||
Text=Select Particle System: | ||
|
||
[tbSearch] | ||
$X=EMPTY_SPACE_SIDES | ||
$Y=getBottom(lblDescription) + EMPTY_SPACE_TOP | ||
$Width=getWidth(SelectParticleSystemTypeWindow) - (EMPTY_SPACE_SIDES * 2) | ||
Suggestion=Search Particle System... | ||
|
||
[btnSelect] | ||
$Width=100 | ||
$X=(getWidth(SelectParticleSystemTypeWindow) - getWidth(btnSelect)) / 2 | ||
$Y=getHeight(SelectParticleSystemTypeWindow) - EMPTY_SPACE_BOTTOM - getHeight(btnSelect) | ||
Text=Select | ||
|
||
[lbObjectList] | ||
$X=EMPTY_SPACE_SIDES | ||
$Y=getBottom(tbSearch) + VERTICAL_SPACING | ||
$Width=getWidth(tbSearch) | ||
$Height=getY(btnSelect) - getY(lbObjectList) - EMPTY_SPACE_TOP | ||
|
||
|
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 |
---|---|---|
|
@@ -39,6 +39,7 @@ public enum RTTIType | |
TeamType, | ||
Waypoint, | ||
CellTag, | ||
SuperWeaponType | ||
SuperWeaponType, | ||
ParticleSystemType | ||
} | ||
} |
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,24 @@ | ||
using System.Globalization; | ||
|
||
namespace TSMapEditor.Models | ||
{ | ||
public class ParticleSystemType : AbstractObject, INIDefined | ||
{ | ||
public ParticleSystemType(string iniName) | ||
{ | ||
ININame = iniName; | ||
} | ||
|
||
[INI(false)] | ||
public string ININame { get; } | ||
|
||
[INI(false)] | ||
public int Index { get; set; } | ||
|
||
public string GetDisplayString() => $"{Index.ToString(CultureInfo.InvariantCulture)} {GetDisplayStringWithoutIndex()}"; | ||
|
||
public string GetDisplayStringWithoutIndex() => ININame; | ||
|
||
public override RTTIType WhatAmI() => RTTIType.ParticleSystemType; | ||
} | ||
} |
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
46 changes: 46 additions & 0 deletions
46
src/TSMapEditor/UI/Windows/SelectParticleSystemTypeWindow.cs
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,46 @@ | ||
using System; | ||
using Rampastring.XNAUI; | ||
using Rampastring.XNAUI.XNAControls; | ||
using TSMapEditor.Models; | ||
|
||
namespace TSMapEditor.UI.Windows | ||
{ | ||
public class SelectParticleSystemTypeWindow : SelectObjectWindow<ParticleSystemType> | ||
{ | ||
public SelectParticleSystemTypeWindow(WindowManager windowManager, Map map) : base(windowManager) | ||
{ | ||
this.map = map; | ||
} | ||
|
||
private readonly Map map; | ||
|
||
public override void Initialize() | ||
{ | ||
Name = nameof(SelectParticleSystemTypeWindow); | ||
base.Initialize(); | ||
} | ||
|
||
protected override void LbObjectList_SelectedIndexChanged(object sender, EventArgs e) | ||
{ | ||
if (lbObjectList.SelectedItem == null) | ||
{ | ||
SelectedObject = null; | ||
return; | ||
} | ||
|
||
SelectedObject = (ParticleSystemType)lbObjectList.SelectedItem.Tag; | ||
} | ||
|
||
protected override void ListObjects() | ||
{ | ||
lbObjectList.Clear(); | ||
|
||
foreach (ParticleSystemType particleSystemType in map.Rules.ParticleSystemTypes) | ||
{ | ||
lbObjectList.AddItem(new XNAListBoxItem() { Text = $"{particleSystemType.Index} {particleSystemType.ININame}", Tag = particleSystemType }); | ||
if (particleSystemType == SelectedObject) | ||
lbObjectList.SelectedIndex = lbObjectList.Items.Count - 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