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.
161 lines
5.2 KiB
161 lines
5.2 KiB
1 year ago
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using UniRx;
|
||
|
using AX.MessageSystem;
|
||
|
|
||
|
public class SituationPlottingMenuPanel : UIView
|
||
|
{
|
||
|
public Toggle DisasterToggle;
|
||
|
public Toggle FireForcesToggle;
|
||
|
public Toggle LinkageForcesToggle;
|
||
|
public Toggle InteriorForcesToggle;
|
||
|
public Toggle PlottingToolsToggle;
|
||
|
|
||
|
public Toggle SourceToggle;
|
||
|
public Toggle CalculatorButton;
|
||
|
public Toggle PlanToggle;
|
||
|
public Button EditorButton;
|
||
|
public Toggle HideNameToggle;
|
||
|
public Button ClearButton;
|
||
|
|
||
|
public override void Awake()
|
||
|
{
|
||
|
base.Awake();
|
||
|
//灾情设定
|
||
|
DisasterToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
if (value)
|
||
|
{
|
||
|
PowerManager.Instance.powerButtonType = PowerButtonType.灾情设定;
|
||
|
UIManager.Instance.Show<PowerDockPanel>();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
UIManager.Instance.Hide<PowerDockPanel>();
|
||
|
}
|
||
|
});
|
||
|
//消防力量
|
||
|
FireForcesToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
if (value)
|
||
|
{
|
||
|
PowerManager.Instance.powerButtonType = PowerButtonType.消防力量;
|
||
|
UIManager.Instance.Show<PowerDockPanel>();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
UIManager.Instance.Hide<PowerDockPanel>();
|
||
|
}
|
||
|
});
|
||
|
//联动力量
|
||
|
LinkageForcesToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
if (value)
|
||
|
{
|
||
|
PowerManager.Instance.powerButtonType = PowerButtonType.联动力量;
|
||
|
UIManager.Instance.Show<PowerDockPanel>();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
UIManager.Instance.Hide<PowerDockPanel>();
|
||
|
}
|
||
|
});
|
||
|
//内部力量
|
||
|
InteriorForcesToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
if (value)
|
||
|
{
|
||
|
PowerManager.Instance.powerButtonType = PowerButtonType.内部力量;
|
||
|
UIManager.Instance.Show<PowerDockPanel>();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
UIManager.Instance.Hide<PowerDockPanel>();
|
||
|
}
|
||
|
});
|
||
|
//标绘工具
|
||
|
PlottingToolsToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
if (value)
|
||
|
{
|
||
|
PowerManager.Instance.powerButtonType = PowerButtonType.标绘工具;
|
||
|
UIManager.Instance.Show<PowerDockPanel>();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
UIManager.Instance.Hide<PowerDockPanel>();
|
||
|
}
|
||
|
});
|
||
|
SourceToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("ICON", value, "OutdoorHydrant");
|
||
|
MessageDispatcher.SendMessage("ICON", value, "SiameseConnection");
|
||
|
});
|
||
|
CalculatorButton.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
if (value)
|
||
|
UIManager.Instance.Show<WaterConsumptionPanel>();
|
||
|
else
|
||
|
UIManager.Instance.Hide<WaterConsumptionPanel>();
|
||
|
} );
|
||
|
//处置方案
|
||
|
PlanToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
if (value)
|
||
|
UIManager.Instance.Show<DisposalPlanPanel>();
|
||
|
else
|
||
|
UIManager.Instance.Hide<DisposalPlanPanel>();
|
||
|
});
|
||
|
//隐藏名称
|
||
|
HideNameToggle.OnValueChangedAsObservable()
|
||
|
.Subscribe(value =>
|
||
|
{
|
||
|
PowerManager.Instance.isHideName = value;
|
||
|
if (SelectionManager.Instance.Sets.Count > 0)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("HIDENAME", value);
|
||
|
}
|
||
|
|
||
|
});
|
||
|
//批量编辑
|
||
|
EditorButton.GetComponent<Button>().OnClickAsObservable()
|
||
|
.Subscribe(_ =>
|
||
|
{
|
||
|
var list = SelectionManager.GetSelectedObjects();
|
||
|
if (list.Count > 0)
|
||
|
{
|
||
|
PowerManager.Instance.taskType = TaskType.none;
|
||
|
UIManager.Instance.Show<PowerAttributePanel>();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageBox.Show("至少选择一个力量!", Color.white);
|
||
|
}
|
||
|
|
||
|
});
|
||
|
//清空
|
||
|
ClearButton.OnClickAsObservable()
|
||
|
.Subscribe(_ => MessageBox.Show("确认清空?", Color.white, PowerManager.Instance.ClearAll));
|
||
|
}
|
||
|
public override void Hide()
|
||
|
{
|
||
|
base.Hide();
|
||
|
DisasterToggle.isOn = false;
|
||
|
FireForcesToggle.isOn = false;
|
||
|
LinkageForcesToggle.isOn = false;
|
||
|
InteriorForcesToggle.isOn = false;
|
||
|
PlottingToolsToggle.isOn = false;
|
||
|
SourceToggle.isOn = false;
|
||
|
CalculatorButton.isOn = false;
|
||
|
PlanToggle.isOn = false;
|
||
|
}
|
||
|
}
|