// ########################################
    // MonoBehaviour Functions
    // http://docs.unity3d.com/ScriptReference/MonoBehaviour.html
    // ########################################

    #region MonoBehaviour

    // Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
    // http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html
    void Start()
    {
        // Set GUIAnimSystemFREE.Instance.m_AutoAnimation to false,
        // this will let you control all GUI Animator elements in the scene via scripts.
        if (enabled)
        {
            GUIAnimSystemFREE.Instance.m_GUISpeed      = 1.0f;
            GUIAnimSystemFREE.Instance.m_AutoAnimation = false;
        }

        m_GE_OrbitCamera = GameObject.FindObjectOfType <GE_OrbitCamera>();

        // Find Unity UI elements
        GameObject go = GameObject.Find("Toggle Invert X");

        if (go != null)
        {
            m_ToggleYaw = go.GetComponent <Toggle>();
        }
        go = GameObject.Find("Toggle Invert Y");
        if (go != null)
        {
            m_TogglePitch = go.GetComponent <Toggle>();
        }
        go = GameObject.Find("Toggle Invert Zoom");
        if (go != null)
        {
            m_ToggleZoom = go.GetComponent <Toggle>();
        }
        go = GameObject.Find("Toggle Help");
        if (go != null)
        {
            m_ToggleHelp = go.GetComponent <Toggle>();
        }
        go = GameObject.Find("Toggle Details");
        if (go != null)
        {
            m_ToggleDetails = go.GetComponent <Toggle>();
        }
        go = GameObject.Find("Button Pinch Zoom");
        if (go != null)
        {
            m_PinchZoom = go.GetComponent <Button>();
        }
        go = GameObject.Find("Button V-Scroll Zoom");
        if (go != null)
        {
            m_VScrollZoom = go.GetComponent <Button>();
        }
        go = GameObject.Find("Panel Settings");
        if (go != null)
        {
            m_PanelSettings = go.GetComponent <GUIAnimFREE>();
        }
        go = GameObject.Find("Button Settings");
        if (go != null)
        {
            m_ButtonSettings = go.GetComponent <GUIAnimFREE>();
        }
        if (m_ButtonSettings != null)
        {
            m_ButtonSettings.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
        }

        go = GameObject.Find("Panel Help1");
        if (go != null)
        {
            m_PanelHelp1 = go.GetComponent <GUIAnimFREE>();
        }
        go = GameObject.Find("Panel Help2");
        if (go != null)
        {
            m_PanelHelp2 = go.GetComponent <GUIAnimFREE>();
        }
        go = GameObject.Find("Panel Details");
        if (go != null)
        {
            m_PanelDetails = go.GetComponent <GUIAnimFREE>();
        }
        if (m_ToggleHelp != null)
        {
            if (m_ToggleHelp.isOn == true)
            {
                if (m_PanelHelp1 != null)
                {
                    m_PanelHelp1.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
                }
                if (m_PanelHelp2 != null)
                {
                    m_PanelHelp2.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
                }
            }
        }
        if (m_ToggleDetails != null && m_PanelDetails != null)
        {
            if (m_ToggleDetails.isOn == true)
            {
                if (m_PanelDetails != null)
                {
                    m_PanelDetails.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
                }
            }
        }

        // Setup some Unity UI elements
        if (m_GE_OrbitCamera != null)
        {
            if (m_ToggleYaw != null)
            {
                m_ToggleYaw.isOn = m_GE_OrbitCamera.m_XInvert;
            }
            if (m_TogglePitch != null)
            {
                m_TogglePitch.isOn = m_GE_OrbitCamera.m_YInvert;
            }
            if (m_ToggleZoom != null)
            {
                m_ToggleZoom.isOn = m_GE_OrbitCamera.m_ZoomInvert;
            }
        }
        if (m_ToggleHelp != null)
        {
            m_ToggleHelp.isOn = true;
        }
        if (m_ToggleDetails != null)
        {
            m_ToggleDetails.isOn = true;
        }
        if (m_PinchZoom != null)
        {
            m_PinchZoom.interactable = false;
        }
        if (m_VScrollZoom != null)
        {
            m_VScrollZoom.interactable = true;
        }
    }
Ejemplo n.º 2
0
    // Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
    // http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html
    void Start()
    {
        // Set GUIAnimSystemFREE.Instance.m_AutoAnimation to false,
        // this will let you control all GUI Animator elements in the scene via scripts.
        if (enabled)
        {
            GUIAnimSystemFREE.Instance.m_GUISpeed = 1.0f;
            GUIAnimSystemFREE.Instance.m_AutoAnimation = false;
        }

        m_GE_OrbitCamera = GameObject.FindObjectOfType<GE_OrbitCamera>();

        // Find Unity UI elements
        GameObject go = GameObject.Find("Toggle Invert X");
        if (go != null)
            m_ToggleYaw = go.GetComponent<Toggle>();
        go = GameObject.Find("Toggle Invert Y");
        if (go != null)
            m_TogglePitch = go.GetComponent<Toggle>();
        go = GameObject.Find("Toggle Invert Zoom");
        if (go != null)
            m_ToggleZoom = go.GetComponent<Toggle>();
        go = GameObject.Find("Toggle Help");
        if (go != null)
            m_ToggleHelp = go.GetComponent<Toggle>();
        go = GameObject.Find("Toggle Details");
        if (go != null)
            m_ToggleDetails = go.GetComponent<Toggle>();
        go = GameObject.Find("Button Pinch Zoom");
        if (go != null)
            m_PinchZoom = go.GetComponent<Button>();
        go = GameObject.Find("Button V-Scroll Zoom");
        if (go != null)
            m_VScrollZoom = go.GetComponent<Button>();
        go = GameObject.Find("Panel Settings");
        if (go != null)
            m_PanelSettings = go.GetComponent<GUIAnimFREE>();
        go = GameObject.Find("Button Settings");
        if (go != null)
            m_ButtonSettings = go.GetComponent<GUIAnimFREE>();
        if (m_ButtonSettings != null)
        {
            m_ButtonSettings.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
        }

        go = GameObject.Find("Panel Help1");
        if (go != null)
            m_PanelHelp1 = go.GetComponent<GUIAnimFREE>();
        go = GameObject.Find("Panel Help2");
        if (go != null)
            m_PanelHelp2 = go.GetComponent<GUIAnimFREE>();
        go = GameObject.Find("Panel Details");
        if (go != null)
            m_PanelDetails = go.GetComponent<GUIAnimFREE>();
        if (m_ToggleHelp != null)
        {
            if (m_ToggleHelp.isOn == true)
            {
                if (m_PanelHelp1 != null)
                {
                    m_PanelHelp1.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
                }
                if (m_PanelHelp2 != null)
                {
                    m_PanelHelp2.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
                }
            }
        }
        if (m_ToggleDetails != null && m_PanelDetails != null)
        {
            if (m_ToggleDetails.isOn == true)
            {
                if (m_PanelDetails != null)
                {
                    m_PanelDetails.MoveIn(GUIAnimSystemFREE.eGUIMove.Self);
                }
            }
        }

        // Setup some Unity UI elements
        if (m_GE_OrbitCamera != null)
        {
            if (m_ToggleYaw != null)
                m_ToggleYaw.isOn = m_GE_OrbitCamera.m_XInvert;
            if (m_TogglePitch != null)
                m_TogglePitch.isOn = m_GE_OrbitCamera.m_YInvert;
            if (m_ToggleZoom != null)
                m_ToggleZoom.isOn = m_GE_OrbitCamera.m_ZoomInvert;
        }
        if (m_ToggleHelp != null)
            m_ToggleHelp.isOn = true;
        if (m_ToggleDetails != null)
            m_ToggleDetails.isOn = true;
        if (m_PinchZoom != null)
            m_PinchZoom.interactable = false;
        if (m_VScrollZoom != null)
            m_VScrollZoom.interactable = true;
    }