123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using System.Collections;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public enum LightIndicatorState
- {
- WHITE,
- WHITE_HIGHLIGHTED,
- RED,
- RED_HIGHLIGHTED,
- ORANGE,
- ORANGE_HIGHLIGHTED,
- YELLOW,
- YELLOW_HIGHLIGHTED,
- GREEN,
- GREEN_HIGHLIGHTED,
- BLUE,
- BLUE_HIGHLIGHTED,
- BLACK,
- BLACK_HIGHLIGHTED
- }
- //================================================================================
- //
- //================================================================================
- public class LightIndicator : MonoBehaviour
- {
- //================================================================================
- //
- //================================================================================
- [SerializeField] private GameObject m_WhiteNormal;
- [SerializeField] private GameObject m_WhiteHighlighted;
- [SerializeField] private GameObject m_RedNormal;
- [SerializeField] private GameObject m_RedHighlighted;
- [SerializeField] private GameObject m_OrangeNormal;
- [SerializeField] private GameObject m_OrangeHighlighted;
- [SerializeField] private GameObject m_YellowNormal;
- [SerializeField] private GameObject m_YellowHighlighted;
- [SerializeField] private GameObject m_GreenNormal;
- [SerializeField] private GameObject m_GreenHighlighted;
- [SerializeField] private GameObject m_BlueNormal;
- [SerializeField] private GameObject m_BlueHighlighted;
- [SerializeField] private GameObject m_BlackNormal;
- [SerializeField] private GameObject m_BlackHighlighted;
-
- private LightIndicatorState m_CurrentState;
- private bool m_Highlighted;
- //================================================================================
- //
- //================================================================================
- void Start()
- {
- m_Highlighted = false;
- m_WhiteNormal.SetActive(true);
-
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_WhiteHighlighted);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_RedNormal);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_RedHighlighted);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_OrangeNormal);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_OrangeHighlighted);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_YellowNormal);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_YellowHighlighted);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_GreenNormal);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_GreenHighlighted);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_BlueNormal);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_BlueHighlighted);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_BlackNormal);
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_BlackHighlighted);
- }
- //================================================================================
- //
- //================================================================================
- public void SetState(LightIndicatorState state)
- {
- m_CurrentState = state;
- switch(state)
- {
- case LightIndicatorState.WHITE:
- m_WhiteNormal.SetActive(true);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.WHITE_HIGHLIGHTED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(true);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.RED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(true);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.RED_HIGHLIGHTED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(true);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.ORANGE:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(true);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.ORANGE_HIGHLIGHTED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(true);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.YELLOW:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(true);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.YELLOW_HIGHLIGHTED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(true);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.GREEN:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(true);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.GREEN_HIGHLIGHTED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(true);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.BLUE:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(true);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.BLUE_HIGHLIGHTED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(true);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.BLACK:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(true);
- m_BlackHighlighted.SetActive(false);
- break;
- case LightIndicatorState.BLACK_HIGHLIGHTED:
- m_WhiteNormal.SetActive(false);
- m_WhiteHighlighted.SetActive(false);
- m_RedNormal.SetActive(false);
- m_RedHighlighted.SetActive(false);
- m_OrangeNormal.SetActive(false);
- m_OrangeHighlighted.SetActive(false);
- m_YellowNormal.SetActive(false);
- m_YellowHighlighted.SetActive(false);
- m_GreenNormal.SetActive(false);
- m_GreenHighlighted.SetActive(false);
- m_BlueNormal.SetActive(false);
- m_BlueHighlighted.SetActive(false);
- m_BlackNormal.SetActive(false);
- m_BlackHighlighted.SetActive(true);
- break;
- }
- }
- //================================================================================
- //
- //================================================================================
- public void Highlight()
- {
- if (!m_Highlighted)
- {
- m_CurrentState = (LightIndicatorState)(m_CurrentState + 1);
- SetState(m_CurrentState);
- m_Highlighted = true;
- }
- }
- //================================================================================
- //
- //================================================================================
- public void DisableHighlight()
- {
- if (m_Highlighted)
- {
- m_Highlighted = false;
- m_CurrentState = (LightIndicatorState)(m_CurrentState - 1);
- SetState(m_CurrentState);
- }
- }
- } // public class LightIndicator : MonoBehaviour
- } // namespace ReaderRabbit
|