Beispiel #1
0
    void Awake()
    {
        map = GenerateMapInfo.instance;
        if (map == null)
        {
            Debug.LogWarning("Can't render map photo. NJGMiniMap instance not found.");
            NGUITools.Destroy(gameObject);
            return;
        }

        if (gameObject.GetComponent <Camera>() == null)
        {
            gameObject.AddComponent <Camera>();
        }

        GetComponent <Camera>().useOcclusionCulling = false;

        Render();
    }
Beispiel #2
0
    /// <summary>
    /// Draw the inspector.
    /// </summary>

    public override void OnInspectorGUI()
    {
        m = target as GenerateMapInfo;
        serializedObject.Update();
        EditorGUIUtility.labelWidth = 130f;

        GUI.SetNextControlName("empty");
        GUI.Button(new Rect(0, 0, 0, 0), "", GUIStyle.none);

        EditorGUILayout.Space();
        EditorGUILayout.Separator();
        GUI.backgroundColor = Color.white;

        GUIStyle activeTabStyle      = new GUIStyle("ButtonMid");
        GUIStyle activeTabStyleLeft  = new GUIStyle("ButtonLeft");
        GUIStyle activeTabStyleRight = new GUIStyle("ButtonRight");

        GUIStyle inactiveTabStyle      = new GUIStyle(activeTabStyle);
        GUIStyle inactiveTabStyleLeft  = new GUIStyle(activeTabStyleLeft);
        GUIStyle inactiveTabStyleRight = new GUIStyle(activeTabStyleRight);

        activeTabStyle.normal      = activeTabStyle.active;
        activeTabStyleLeft.normal  = activeTabStyleLeft.active;
        activeTabStyleRight.normal = activeTabStyleRight.active;

        GUILayout.BeginHorizontal();
        for (int i = 0, imax = (int)GenerateMapInfo.SettingsScreen._LastDoNotUse; i < imax; i++)
        {
            GUIStyle active = activeTabStyleLeft;
            if (i > 0)
            {
                active = activeTabStyle;
            }
            if (i == (int)GenerateMapInfo.SettingsScreen._LastDoNotUse - 1)
            {
                active = activeTabStyleRight;
            }

            GUIStyle inactive = inactiveTabStyleLeft;
            if (i > 0)
            {
                inactive = inactiveTabStyle;
            }
            if (i == (int)GenerateMapInfo.SettingsScreen._LastDoNotUse - 1)
            {
                inactive = inactiveTabStyleRight;
            }

            GUI.backgroundColor = m.screen == (GenerateMapInfo.SettingsScreen)i ? Color.cyan : Color.white;
            if (GUILayout.Button(((GenerateMapInfo.SettingsScreen)i).ToString(), m.screen == (GenerateMapInfo.SettingsScreen)i ? active : inactive))
            {
                GUI.FocusControl("empty");
                m.screen = (GenerateMapInfo.SettingsScreen)i;
            }
        }
        GUI.backgroundColor = Color.white;

        GUILayout.EndHorizontal();

        switch (m.screen)
        {
        case GenerateMapInfo.SettingsScreen.General:
            DrawGeneralUI();
            break;
        }
        EditorGUILayout.Separator();

        Save(false);
        serializedObject.ApplyModifiedProperties();
    }