84 lines
2.2 KiB
C#
84 lines
2.2 KiB
C#
using UnityEngine;
|
|
using WI;
|
|
using CHN;
|
|
using System.Linq;
|
|
using System;
|
|
|
|
public class HighLighterManager : MonoBehaviour, ISingle
|
|
{
|
|
private Machine[] machines;
|
|
private Machine currentMachine;
|
|
public override void AfterStart()
|
|
{
|
|
var building = FindSingle<Building>();
|
|
machines = building.floors.SelectMany(f => f.machines).ToArray();
|
|
}
|
|
|
|
public void ClickNotKPIToHighlight(Machine highLightMachine)
|
|
{
|
|
ActiveHighLighter(highLightMachine);
|
|
ActiveMachineKPI(highLightMachine);
|
|
}
|
|
public void ActiveHighLighter(Machine highLightMachine)
|
|
{
|
|
foreach (var machine in machines)
|
|
{
|
|
machine.DeactiveHighLighter();
|
|
}
|
|
currentMachine = highLightMachine;
|
|
currentMachine.ActiveHighLighter();
|
|
}
|
|
public void ResetAllHighLighter()
|
|
{
|
|
foreach (var machine in machines)
|
|
{
|
|
machine.DeactiveHighLighter();
|
|
|
|
if (machine.machineKPI != null)
|
|
{
|
|
machine.machineKPI.Shrink();
|
|
}
|
|
}
|
|
}
|
|
private void ActiveMachineKPI(Machine curentMachine)
|
|
{
|
|
foreach (var machine in machines)
|
|
{
|
|
if (machine.machineKPI != null)
|
|
{
|
|
machine.machineKPI.Shrink();
|
|
}
|
|
}
|
|
|
|
if (curentMachine.machineKPI != null)
|
|
{
|
|
curentMachine.machineKPI.Expand();
|
|
}
|
|
}
|
|
public void SetTargetPosToMachine(Machine machine)
|
|
{
|
|
OrbitalController controller = FindSingle<OrbitalController>();
|
|
if (controller.viewMode != ViewMode.PerspectiveView)
|
|
{
|
|
controller.SetViewMode(ViewMode.PerspectiveView);
|
|
}
|
|
|
|
var building = FindSingle<Building>();
|
|
int changeFloor = building.floors[0].floorIndex;
|
|
|
|
int libraryMachineFloor = machine.GetMachineFloorIndex();
|
|
if (libraryMachineFloor > changeFloor)
|
|
{
|
|
changeFloor = libraryMachineFloor;
|
|
}
|
|
|
|
var centerPos = machine.centerPos;
|
|
|
|
var slider = FindSingle<Canvas_Right>().panel_floorcontrol;
|
|
slider.ChangeValueFromOutside(changeFloor);
|
|
|
|
controller.option.currentDistance = 15f;
|
|
controller.SetTargetPos(centerPos);
|
|
}
|
|
}
|