Experimental stuff for now. Don't think too much about it. Branched off Rabi-Ribi Autosplitter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rabiribi-display/rabi_splitter_WPF/MainContext.cs

555 lines
14 KiB

8 years ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
8 years ago
using System.Windows.Data;
8 years ago
using rabi_splitter_WPF.Annotations;
using System.Windows;
8 years ago
namespace rabi_splitter_WPF
{
[ValueConversion(typeof(bool), typeof(Visibility))]
public class InvertableBooleanToVisibilityConverter : IValueConverter
{
#region IValueConverter Members
// Code taken from http://stackoverflow.com/a/2427307
enum Parameter
{
VisibleWhenTrue, VisibleWhenFalse
}
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
var boolValue = (bool)value;
var direction = (Parameter)Enum.Parse(typeof(Parameter), (string)parameter);
if (direction == Parameter.VisibleWhenTrue) return boolValue ? Visibility.Visible : Visibility.Collapsed;
else return boolValue ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
return null;
}
#endregion
}
8 years ago
[ValueConversion(typeof(bool), typeof(bool))]
public class InverseBooleanConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
if (targetType != typeof(bool))
throw new InvalidOperationException("The target must be a boolean");
return !(bool)value;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
#endregion
}
public class EntityStatsData : INotifyPropertyChanged
{
private int _addr;
private int _intval;
private float _floatval;
public int Addr
{
get { return _addr; }
set
{
if (value == _addr) return;
_addr = value;
OnPropertyChanged(nameof(Addr));
}
}
public int IntVal
{
get { return _intval; }
set
{
if (value == _intval) return;
_intval = value;
OnPropertyChanged(nameof(IntVal));
}
}
public float FloatVal
{
get { return _floatval; }
set
{
if (value == _floatval) return;
_floatval = value;
OnPropertyChanged(nameof(FloatVal));
}
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
8 years ago
public class BossData:INotifyPropertyChanged
{
8 years ago
private int _bossIdx;
private int _bossId;
private int _bossHp;
8 years ago
8 years ago
public int BossIdx
{
get { return _bossIdx; }
set
{
if (value == _bossIdx) return;
_bossIdx = value;
OnPropertyChanged(nameof(BossIdx));
}
}
public int BossID
{
get { return _bossId; }
set
{
if (value == _bossId) return;
_bossId = value;
OnPropertyChanged(nameof(BossID));
}
}
public int BossHP
{
get { return _bossHp; }
set
{
if (value == _bossHp) return;
_bossHp = value;
OnPropertyChanged(nameof(BossHP));
}
}
8 years ago
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public class DebugContext : INotifyPropertyChanged
8 years ago
{
private int _entityAnalysisIndex;
8 years ago
private bool _bossEvent;
private string _debugLog;
public ObservableCollection<BossData> BossList = new ObservableCollection<BossData>();
public ObservableCollection<EntityStatsData> EntityStatsListData = new ObservableCollection<EntityStatsData>();
public int targetEntityListSize;
public ObservableCollection<EntityStatsData> EntityStatsListView
{
get
{
return EntityStatsListData;
}
}
8 years ago
8 years ago
public DebugContext()
{
this.EntityAnalysisIndex = 0;
BossList =new ObservableCollection<BossData>();
8 years ago
for (int i = 0; i < 50; i++)
{
BossList.Add(new BossData()
{
BossIdx = i
});
}
while (EntityStatsListData.Count < 449)
{
EntityStatsListData.Add(new EntityStatsData() { Addr = EntityStatsListData.Count * 4 });
}
}
public int EntityAnalysisIndex
{
get { return _entityAnalysisIndex; }
set
{
if (value == _entityAnalysisIndex) return;
_entityAnalysisIndex = value;
OnPropertyChanged(nameof(EntityAnalysisIndex));
}
8 years ago
}
8 years ago
public bool BossEvent
{
get { return _bossEvent; }
set
{
if (value == _bossEvent) return;
_bossEvent = value;
OnPropertyChanged(nameof(BossEvent));
}
}
public string DebugLog
{
get { return _debugLog; }
set
{
if (value == _debugLog) return;
_debugLog = value;
OnPropertyChanged(nameof(DebugLog));
}
}
8 years ago
public void Log(string message)
{
this.DebugLog += message + "\n";
}
8 years ago
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
class MainContext : INotifyPropertyChanged
{
8 years ago
public string oldtitle;
public int veridx;
8 years ago
private int _serverPort;
private string _gameVer;
private string _gameMusic;
private bool _igt;
8 years ago
private string _text1;
private string _text2;
private string _text3;
private string _text4;
private string _text5;
private string _text6;
private string _text7;
private string _text8;
private string _text9;
private string _text10;
private string _text11;
private string _text12;
private string _text13;
private string _text14;
private string _text15;
private string _text16;
private string _text17;
private string _text18;
private string _text19;
private string _text20;
8 years ago
public string Text1
{
get { return _text1; }
set
{
if (value == _text1) return;
_text1 = value;
8 years ago
OnPropertyChanged(nameof(Text1));
}
}
public string Text2
{
get { return _text2; }
set
{
if (value == _text2) return;
_text2 = value;
8 years ago
OnPropertyChanged(nameof(Text2));
}
}
public string Text3
8 years ago
{
8 years ago
get { return _text3; }
8 years ago
set
{
8 years ago
if (value == _text3) return;
_text3 = value;
8 years ago
OnPropertyChanged(nameof(Text3));
8 years ago
}
}
8 years ago
public string Text4
8 years ago
{
8 years ago
get { return _text4; }
8 years ago
set
{
8 years ago
if (value == _text4) return;
_text4 = value;
8 years ago
OnPropertyChanged(nameof(Text4));
8 years ago
}
}
8 years ago
public string Text5
8 years ago
{
8 years ago
get { return _text5; }
8 years ago
set
{
8 years ago
if (value == _text5) return;
_text5 = value;
8 years ago
OnPropertyChanged(nameof(Text5));
8 years ago
}
}
8 years ago
public string Text6
8 years ago
{
8 years ago
get { return _text6; }
8 years ago
set
{
8 years ago
if (value == _text6) return;
_text6 = value;
8 years ago
OnPropertyChanged(nameof(Text6));
8 years ago
}
}
8 years ago
public string Text7
8 years ago
{
8 years ago
get { return _text7; }
8 years ago
set
{
8 years ago
if (value == _text7) return;
_text7 = value;
8 years ago
OnPropertyChanged(nameof(Text7));
}
}
public string Text8
{
get { return _text8; }
set
{
if (value == _text8) return;
_text8 = value;
8 years ago
OnPropertyChanged(nameof(Text8));
8 years ago
}
}
8 years ago
public string Text9
8 years ago
{
8 years ago
get { return _text9; }
8 years ago
set
{
8 years ago
if (value == _text9) return;
_text9 = value;
8 years ago
OnPropertyChanged(nameof(Text9));
8 years ago
}
}
8 years ago
public string Text10
8 years ago
{
8 years ago
get { return _text10; }
8 years ago
set
{
8 years ago
if (value == _text10) return;
_text10 = value;
8 years ago
OnPropertyChanged(nameof(Text10));
8 years ago
}
}
8 years ago
public string Text11
8 years ago
{
8 years ago
get { return _text11; }
8 years ago
set
{
8 years ago
if (value == _text11) return;
_text11 = value;
8 years ago
OnPropertyChanged(nameof(Text11));
8 years ago
}
}
8 years ago
public string Text12
8 years ago
{
8 years ago
get { return _text12; }
8 years ago
set
{
8 years ago
if (value == _text12) return;
_text12 = value;
8 years ago
OnPropertyChanged(nameof(Text12));
8 years ago
}
}
8 years ago
public string Text13
{
8 years ago
get { return _text13; }
set
{
8 years ago
if (value == _text13) return;
_text13 = value;
8 years ago
OnPropertyChanged(nameof(Text13));
}
}
8 years ago
public string Text14
8 years ago
{
8 years ago
get { return _text14; }
8 years ago
set
{
8 years ago
if (value == _text14) return;
_text14 = value;
8 years ago
OnPropertyChanged(nameof(Text14));
8 years ago
}
}
8 years ago
public string Text15
{
get { return _text15; }
set
{
if (value == _text15) return;
_text15 = value;
8 years ago
OnPropertyChanged(nameof(Text15));
}
}
public string Text16
{
get { return _text16; }
set
{
if (value == _text16) return;
_text16 = value;
OnPropertyChanged(nameof(Text16));
}
}
public string Text17
{
get { return _text17; }
set
{
if (value == _text17) return;
_text17 = value;
OnPropertyChanged(nameof(Text17));
}
}
public string Text18
{
get { return _text18; }
set
{
if (value == _text18) return;
_text18 = value;
OnPropertyChanged(nameof(Text18));
}
}
public string Text19
{
get { return _text19; }
set
{
if (value == _text19) return;
_text19 = value;
OnPropertyChanged(nameof(Text19));
}
}
public string Text20
{
get { return _text20; }
set
{
if (value == _text20) return;
_text20 = value;
OnPropertyChanged(nameof(Text20));
}
}
8 years ago
public int ServerPort
{
get { return _serverPort; }
set
{
if (value == _serverPort) return;
_serverPort = value;
OnPropertyChanged(nameof(ServerPort));
}
}
public string GameVer
{
get { return _gameVer; }
set
{
if (value == _gameVer) return;
_gameVer = value;
OnPropertyChanged(nameof(GameVer));
}
}
public string GameMusic
{
get { return _gameMusic; }
set
{
if (value == _gameMusic) return;
_gameMusic = value;
OnPropertyChanged(nameof(GameMusic));
}
}
public bool Igt
{
get { return _igt; }
set
{
if (value == _igt) return;
_igt = value;
OnPropertyChanged(nameof(Igt));
}
}
8 years ago
8 years ago
public MainContext()
{
this.ServerPort = 16834;
this.Igt = true;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}