Skip to content

Commit

Permalink
修复多目标问题
Browse files Browse the repository at this point in the history
  • Loading branch information
acygen committed Sep 12, 2022
1 parent 83dc883 commit 50904bc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 7 deletions.
48 changes: 41 additions & 7 deletions Tool/BattleTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ static void Postfix(BasePartsData __instance,bool _enable, int _value, UnitCtrl.
BattleHeaderController instance = SingletonMonoBehaviour<BattleHeaderController>.Instance;
if (instance != null)
{
UpdateBossDEF(instance.BossGauge, __instance.Owner.Def, __instance.Owner.MagicDef,__instance.Owner.Energy);
/*if (__instance.Owner.IsPartsBoss)
{
UpdateBossDEF(instance.BossGauge, __instance.Owner);
}
else*/
UpdateBossDEF( __instance.Owner);
}
}
}
Expand All @@ -63,16 +68,43 @@ static void Postfix(BasePartsData __instance,bool _enable, int _value, UnitCtrl.
PCRBattle.Instance.OnBossDEFChange(__instance.Owner, des);
}
}
public static void UpdateBossDEF(PartsBossGauge __instance, int def, int mdef,float tp)
public static void UpdateBossDEF(UnitCtrl a)
{
string inputstr = "DEF:" + def + " MDEF:" + mdef + " TP:" + tp.ToString("F2");
CustomUILabel nameAndLevel = Traverse.Create(__instance).Field("nameAndLevel").GetValue<CustomUILabel>();
nameAndLevel.SetText(inputstr);
int pos = 0;
try
{
PartsBossGauge instance = SingletonMonoBehaviour<BattleHeaderController>.Instance.BossGauge;
if (instance == null || a == null)
return;
pos = 1000;
string inputstr = "DEF:" + a.Def + " MDEF:" + a.MagicDef + " TP:" + a.Energy.ToString("F2");
pos = 2000;
if (a.IsPartsBoss)
{
bool showMDEF = PCRSettings.mutiTargetShowMDEF;
inputstr = showMDEF ? "MDEF:" : "DEF:";
pos += 10;
foreach (PartsData part in a.BossPartsListForBattle)
{
inputstr += showMDEF ? $"{part.GetMagicDefZero()} " : $"{part.GetDefZero()} ";
pos += 100;
}
inputstr += $"TP:{a.Energy:F2}";
}
pos = 3000;
CustomUILabel nameAndLevel = Traverse.Create(instance).Field("nameAndLevel").GetValue<CustomUILabel>();
pos = 4000;
nameAndLevel.SetText(inputstr);
}
catch(Exception eex)
{
Cute.ClientLog.AccumulateClientLog($"ERROR AT:{pos}" + eex.Message);
}
}
public static void UpdateBossTP(UnitCtrl a)
{
BattleHeaderController instance = SingletonMonoBehaviour<BattleHeaderController>.Instance;
UpdateBossDEF(instance.BossGauge, a.Def, a.MagicDef, a.Energy);
//BattleHeaderController instance = SingletonMonoBehaviour<BattleHeaderController>.Instance;
UpdateBossDEF(a);
}

}
Expand All @@ -86,6 +118,8 @@ static void Postfix(PartsData __instance, bool _enable, int _value, UnitCtrl.Buf
Battlelog.MyLog(null, Elements.eBattleLogType.SET_BUFF_DEBUFF, (int)_kind, _value, __instance.Index, 0, 0, (_enable ? 1 : 0), 200, _source, __instance.Owner);
string des = $"来自{PCRBattle.Instance.GetName(_source?.UnitId ?? 0)},值{_value}";
PCRBattle.Instance.OnBossDEFChange(__instance.Owner,des,__instance.Index);
Buffdef0.UpdateBossDEF( __instance.Owner);

}
}

Expand Down
2 changes: 2 additions & 0 deletions Tool/PCRSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static PCRSettings Instance
public static bool showExectTime => Instance.battleSetting.showExectTime;
public static bool showExectTimeReal => Instance.battleSetting.showRealFrame;
public static bool showBossDEF => Instance.battleSetting.showBossDEF;
public static bool mutiTargetShowMDEF => Instance.battleSetting.mutiTargetShowMDEF;
public static int battleSeed
{
get
Expand Down Expand Up @@ -743,6 +744,7 @@ public class BattleSetting
public bool showBossDEF = true;
public bool useLogBarrier = true;
public bool showUI = false;
public bool mutiTargetShowMDEF = false;
}
public class MyPlayerPrefab
{
Expand Down
21 changes: 21 additions & 0 deletions UI/ManagerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public class ManagerForm : Form
private Label label20;
private TextBox VersionText;
private Button ConfigVersion;
private CheckBox checkBoxMutiTarget;
private PCRSettings Settings;
#endregion
public ManagerForm()
Expand Down Expand Up @@ -217,6 +218,7 @@ public void ReflashBattleSetting()
checkBox2.Checked = Settings.battleSetting.useLogBarrier;
timeCheck2.Checked = Settings.battleSetting.showRealFrame;
showUICheck.Checked = Settings.battleSetting.showUI;
checkBoxMutiTarget.Checked = Settings.battleSetting.mutiTargetShowMDEF;
}


Expand Down Expand Up @@ -325,6 +327,7 @@ private void InitializeComponent()
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.label16 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.checkBoxMutiTarget = new System.Windows.Forms.CheckBox();
this.statusStrip1.SuspendLayout();
this.clanSetting.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cb_seed)).BeginInit();
Expand Down Expand Up @@ -853,6 +856,7 @@ private void InitializeComponent()
//
// tabPage2
//
this.tabPage2.Controls.Add(this.checkBoxMutiTarget);
this.tabPage2.Controls.Add(this.showUICheck);
this.tabPage2.Controls.Add(this.label19);
this.tabPage2.Controls.Add(this.label18);
Expand Down Expand Up @@ -1164,6 +1168,17 @@ private void InitializeComponent()
this.textBox1.Text = "2021/06/25 10:00:00";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// checkBoxMutiTarget
//
this.checkBoxMutiTarget.AutoSize = true;
this.checkBoxMutiTarget.Location = new System.Drawing.Point(23, 246);
this.checkBoxMutiTarget.Name = "checkBoxMutiTarget";
this.checkBoxMutiTarget.Size = new System.Drawing.Size(174, 31);
this.checkBoxMutiTarget.TabIndex = 28;
this.checkBoxMutiTarget.Text = "多目标显示魔防";
this.checkBoxMutiTarget.UseVisualStyleBackColor = true;
this.checkBoxMutiTarget.CheckedChanged += new System.EventHandler(this.checkBoxMutiTarget_CheckedChanged);
//
// ManagerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 27F);
Expand Down Expand Up @@ -1385,5 +1400,11 @@ private void ConfigVersion_Click(object sender, EventArgs e)
MessageBox.Show("输入错误!");
}
}

private void checkBoxMutiTarget_CheckedChanged(object sender, EventArgs e)
{
Settings.battleSetting.mutiTargetShowMDEF = checkBoxMutiTarget.Checked;
Settings.Save(5);
}
}
}

0 comments on commit 50904bc

Please sign in to comment.