merge
This commit is contained in:
@@ -17,6 +17,7 @@ namespace CHN
|
||||
public Panel_WorkTimeAnalysis panel_worktimeanalysis;
|
||||
public Panel_InjectionProduction panel_injectionproduction;
|
||||
public Panel_AssemblyProduction panel_assemblyproduction;
|
||||
public Panel_MiniMap panel_minimap;
|
||||
[Label(typeof(UI_WorkAnalysis),nameof(UI_WorkAnalysis))]
|
||||
public UI_WorkAnalysis ui_workanalysis;
|
||||
//public Panel_MachineDashBoard panel_machinedashboard;
|
||||
|
||||
78
Assets/Scripts/UI/Panel_MiniMap.cs
Normal file
78
Assets/Scripts/UI/Panel_MiniMap.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using WI;
|
||||
|
||||
namespace CHN
|
||||
{
|
||||
public class Panel_MiniMap : PanelBase
|
||||
{
|
||||
OrbitalControllerTarget target;
|
||||
|
||||
Image MiniMapScreen;
|
||||
RectTransform Image_MiniMapIcon;
|
||||
TextMeshProUGUI Text_MiniMapFloor;
|
||||
Button Button_Close;
|
||||
|
||||
Vector2 worldMin = new Vector2(-40.25f, -32.0f);
|
||||
Vector2 worldMax = new Vector2(57.25f, 31.0f);
|
||||
|
||||
[SerializeField]
|
||||
Sprite[] miniMapImages;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
target = FindSingle<OrbitalControllerTarget>();
|
||||
|
||||
Button_Close.onClick.AddListener(Deactivate);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdateMiniMapIcon();
|
||||
}
|
||||
|
||||
public void ChangeMiniMapFloor(int floorValue)
|
||||
{
|
||||
int floor = floorValue + 1;
|
||||
Text_MiniMapFloor.text = floor.ToString() + "F";
|
||||
|
||||
MiniMapScreen.sprite = miniMapImages[floorValue];
|
||||
}
|
||||
|
||||
void UpdateMiniMapIcon()
|
||||
{
|
||||
Vector2 worldPos = new Vector2(target.transform.position.x, target.transform.position.z);
|
||||
Vector2 normalizedPos = (worldPos - worldMin) / (worldMax - worldMin);
|
||||
|
||||
RectTransform miniMapRect = MiniMapScreen.GetComponent<RectTransform>();
|
||||
Vector2 miniMapSize = miniMapRect.rect.size;
|
||||
Vector2 iconPos = new Vector2(
|
||||
(normalizedPos.x * miniMapSize.x) - (miniMapSize.x * 0.5f),
|
||||
(normalizedPos.y * miniMapSize.y) - (miniMapSize.y * 0.5f)
|
||||
);
|
||||
|
||||
Image_MiniMapIcon.anchoredPosition = iconPos;
|
||||
|
||||
float cameraRotateY = Camera.main.transform.eulerAngles.y;
|
||||
Image_MiniMapIcon.localEulerAngles = new Vector3(0, 0, -cameraRotateY);
|
||||
}
|
||||
|
||||
public void SetActive()
|
||||
{
|
||||
var isActive = gameObject.activeSelf;
|
||||
var active = isActive ? false : true;
|
||||
|
||||
gameObject.SetActive(active);
|
||||
}
|
||||
|
||||
void Deactivate()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/UI/Panel_MiniMap.cs.meta
Normal file
11
Assets/Scripts/UI/Panel_MiniMap.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47e7868f9dae9794b9e1e67e98f5178e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user