123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class API_Module_SafetyArea
- {
- /// <summary>
- /// 进入安全区域时的回调注册
- /// </summary>
- /// <param name="callback"></param>
- public static void RegistSafetyAreaEnterCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnEnterSafetyArea += callback;
- }
- /// <summary>
- /// 进入安全区域时的回调注销
- /// </summary>
- /// <param name="callback"></param>
- public static void UnRegistSafetyAreaEnterCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnEnterSafetyArea -= callback;
- }
- /// <summary>
- /// 退出安全区域时的回调注册
- /// </summary>
- /// <param name="callback"></param>
- public static void RegistSafetyAreaExitCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnExitSafetyArea += callback;
- }
- /// <summary>
- /// 退出安全区域时的回调注销
- /// </summary>
- /// <param name="callback"></param>
- public static void UnRegistSafetyAreaExitCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnExitSafetyArea += callback;
- }
- /// <summary>
- /// 开始设置安全区域时的回调注册
- /// </summary>
- /// <param name="callback"></param>
- public static void RegistSafetyAreaStartCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnBeginSetSafeArea += callback;
- }
- /// <summary>
- /// 开始设置安全区域时的回调注销
- /// </summary>
- /// <param name="callback"></param>
- public static void UnRegistSafetyAreaStartCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnBeginSetSafeArea -= callback;
- }
- /// <summary>
- /// 完成设置安全区域时的回调注册
- /// </summary>
- /// <param name="callback"></param>
- public static void RegistSafetyAreaFinishCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnFinishSetSafeArea += callback;
- }
- /// <summary>
- /// 完成设置安全区域时的回调注销
- /// </summary>
- /// <param name="callback"></param>
- public static void UnRegistSafetyAreaFinishCallback(Action callback)
- {
- SafetyAreaManager.Instance.OnFinishSetSafeArea += callback;
- }
- /// <summary>
- /// 开始设置安全区域
- /// </summary>
- public static void StartSetSafetyArea()
- {
- SafetyAreaManager.Instance.StartSetSafetyArea();
- }
- /// <summary>
- /// 重新设置区域高度(如果没有安全区域则会重新设置)
- /// </summary>
- public static void StartSetSafetyAreaHeight()
- {
- SafetyAreaManager.Instance.StartSetSafetyAreaHeight();
- }
- /// <summary>
- /// 获取安全区域颜色
- /// </summary>
- /// <returns></returns>
- public static int GetSafetyAreaColor()
- {
- return SafetyAreaManager.Instance.OriginSafetyAreaColorIndex;
- }
- /// <summary>
- /// 设置安全区域颜色
- /// </summary>
- /// <param name="color"></param>
- public static void SetSafetyAreaColor(int index)
- {
- SafetyAreaManager.Instance.OriginSafetyAreaColorIndex = index;
- }
- /// <summary>
- /// 获取低头是否显示安全区域
- /// </summary>
- /// <returns></returns>
- public static bool GetShowAreaWhenBowHead()
- {
- return SafetyAreaManager.Instance.ShowAreaWhenBowHead;
- }
- /// <summary>
- /// 低头时是否显示游戏区域轮廓
- /// </summary>
- /// <param name="isOpen"></param>
- public static void SetShowAreaWhenBowHead(bool isOpen)
- {
- SafetyAreaManager.Instance.ShowAreaWhenBowHead = isOpen;
- }
- /// <summary>
- /// 获取灵敏度
- /// </summary>
- /// <returns></returns>
- public static float GetSensitivity()
- {
- return SafetyAreaManager.Instance.OriginAlphaParam;
- }
- /// <summary>
- /// 设置安全区域灵敏度 范围0~1
- /// </summary>
- /// <param name="value"></param>
- public static void SetSensitivity(float value)
- {
- SafetyAreaManager.Instance.OriginAlphaParam = value;
- }
- /// <summary>
- /// 删除已有的原地区域
- /// </summary>
- public static void DestroySafetyArea()
- {
- SafetyAreaManager.Instance.DestroySafetyArea();
- }
- /// <summary>
- /// 禁用安全区域显示
- /// </summary>
- /// <param name="isDisable"></param>
- public static void DisableSafetyAreaDisplay(bool isDisable)
- {
- SafetyAreaManager.Instance.IsDisableSafetyArea = isDisable;
- }
- /// <summary>
- /// 查看是否可以双击查看SeeThroguh
- /// </summary>
- /// <returns></returns>
- public static bool CheckDoubleTapSeeThrough()
- {
- return SafetyAreaManager.Instance.DoubleClickShowSeeThrough;
- }
- /// <summary>
- /// 设置双击查看SeeThrough
- /// </summary>
- /// <param name="isOn"></param>
- public static void SetDouleTapSeeThrough(bool isOn)
- {
- SafetyAreaManager.Instance.DoubleClickShowSeeThrough = isOn;
- }
- /// <summary>
- /// 获取安全区域类型
- /// </summary>
- /// <returns></returns>
- public static SafetyAreaTypeEnum GetSafetyAreaType()
- {
- return SafetyAreaManager.Instance.GetSafetyAreaType();
- }
- /// <summary>
- /// 设置过程中强制关闭
- /// </summary>
- public static void CancelSafetyArea()
- {
- SafetyAreaManager.Instance.UserCancelStep();
- }
- }
|