Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/KGFMapSystemScriptControlDemo.cs
2026-02-21 16:45:37 +08:00

65 lines
1.6 KiB
C#

using System;
using UnityEngine;
public class KGFMapSystemScriptControlDemo : MonoBehaviour
{
private KGFMapSystem itsMapSystem;
private void Start()
{
itsMapSystem = GetComponent<KGFMapSystem>();
itsMapSystem.EventClickedOnMinimap += new Action<object, EventArgs>(OnUserClickedOnMap);
itsMapSystem.EventUserFlagCreated += new Action<object, EventArgs>(OnUserFlagWasCreated);
}
private void OnUserClickedOnMap(object theSender, EventArgs theEventArgs)
{
KGFMapSystem.KGFClickEventArgs e = theEventArgs as KGFMapSystem.KGFClickEventArgs;
if (e != null)
{
Debug.Log("Clicked at position(world space): " + e.itsPosition);
}
}
private void OnUserFlagWasCreated(object theSender, EventArgs theEventArgs)
{
KGFMapSystem.KGFFlagEventArgs e = theEventArgs as KGFMapSystem.KGFFlagEventArgs;
if (e != null)
{
Debug.Log("Created marker at position(world space): " + e.itsPosition);
}
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.M))
{
itsMapSystem.SetFullscreen(!itsMapSystem.GetFullscreen());
}
else if (Input.GetKeyDown(KeyCode.Alpha1))
{
itsMapSystem.ZoomIn();
}
else if (Input.GetKeyDown(KeyCode.Alpha2))
{
itsMapSystem.ZoomOut();
}
else if (Input.GetKeyDown(KeyCode.Alpha3))
{
itsMapSystem.ZoomMax();
}
else if (Input.GetKeyDown(KeyCode.Alpha4))
{
itsMapSystem.ZoomMin();
}
else if (Input.GetKeyDown(KeyCode.H))
{
itsMapSystem.SetViewportEnabled(!itsMapSystem.GetViewportEnabled());
}
else if (Input.GetKeyDown(KeyCode.Z))
{
itsMapSystem.SetModeStatic(!itsMapSystem.GetModeStatic());
}
}
}