コード例 #1
0
ファイル: M_GUICamera.cs プロジェクト: wolvtodd/MARK-II
    public static GUIRect GUI_RECT(Vector3 cameraPos)
    {
        var tempGUIRect  = new GUIRect();
        var curGUICamera = GameObject.FindWithTag("GUICamera");
        var halfHeight   = curGUICamera.camera.orthographicSize;
        var halfWidth    = halfHeight * curGUICamera.camera.aspect;

        tempGUIRect.UpperLeft  = cameraPos;
        tempGUIRect.UpperLeft += Vector3.left * halfWidth;
        tempGUIRect.UpperLeft += Vector3.up * halfHeight;

        tempGUIRect.UpperRight  = cameraPos;
        tempGUIRect.UpperRight += Vector3.right * halfWidth;
        tempGUIRect.UpperRight += Vector3.up * halfHeight;

        tempGUIRect.LowerRight  = cameraPos;
        tempGUIRect.LowerRight += Vector3.right * halfWidth;
        tempGUIRect.LowerRight += Vector3.down * halfHeight;

        tempGUIRect.LowerLeft  = cameraPos;
        tempGUIRect.LowerLeft += Vector3.left * halfWidth;
        tempGUIRect.LowerLeft += Vector3.down * halfHeight;

        return(tempGUIRect);
    }
コード例 #2
0
ファイル: M_GUICamera.cs プロジェクト: wolvtodd/MARK-II
    public static GUIRect GUI_RECT(Vector3 cameraPos)
    {
        var tempGUIRect = new GUIRect();
        var curGUICamera = GameObject.FindWithTag("GUICamera");
        var halfHeight = curGUICamera.camera.orthographicSize;
        var halfWidth = halfHeight * curGUICamera.camera.aspect;

        tempGUIRect.UpperLeft = cameraPos;
        tempGUIRect.UpperLeft += Vector3.left * halfWidth;
        tempGUIRect.UpperLeft += Vector3.up * halfHeight;

        tempGUIRect.UpperRight = cameraPos;
        tempGUIRect.UpperRight += Vector3.right * halfWidth;
        tempGUIRect.UpperRight += Vector3.up * halfHeight;

        tempGUIRect.LowerRight = cameraPos;
        tempGUIRect.LowerRight += Vector3.right * halfWidth;
        tempGUIRect.LowerRight += Vector3.down * halfHeight;

        tempGUIRect.LowerLeft = cameraPos;
        tempGUIRect.LowerLeft += Vector3.left * halfWidth;
        tempGUIRect.LowerLeft += Vector3.down * halfHeight;

        return tempGUIRect;
    }
コード例 #3
0
        public static bool Foldout(GUIRect rect, ReflectedProperty property, GUIContent content = null)
        {
            bool isExpanded = EditorGUI.Foldout(rect.GetFieldRect(), property.IsExpanded, content ?? property.GUIContent);

            property.IsExpanded = isExpanded;
            return(isExpanded);
        }
コード例 #4
0
ファイル: CPlayer.cs プロジェクト: qkrsogusl3/coop_rungame
    private void OnGUI()
    {
        if (IsOnGUI == false)
        {
            return;
        }

        GUIRect guiRect = new GUIRect();


        GUI.color      = Color.green;
        guiRect.center = new Vector2(Screen.width * 0.5f, Screen.height * 0.15f);
        guiRect.size   = new Vector2(Screen.width * 0.18f, Screen.height * 0.08f);
        GUI.Button(guiRect.rect, mIsRotateFail ? "Rotate Fail" : "Rotate Success");

        GUI.contentColor = mIsDirectionInputChecking ? Color.green : Color.red;
        guiRect.center   = new Vector2(Screen.width * 0.5f, Screen.height * 0.25f);
        GUI.Button(guiRect.rect, "Input Check");

        //GUI.contentColor = mIsToLeftWind ? Color.green : Color.black;
        //guiRect.center = new Vector2(Screen.width * 0.25f, Screen.height * 0.05f);
        //guiRect.size = new Vector2(Screen.width * 0.45f, Screen.height * 0.1f);
        //GUI.Button(guiRect.rect, "ToLeft");

        //GUI.contentColor = mIsToRightWind ? Color.green : Color.black;
        //guiRect.center = new Vector2(Screen.width * 0.75f, Screen.height * 0.05f);
        //GUI.Button(guiRect.rect, "ToRight");


        GUI.Label(new Rect(Screen.width * 0.01f, Screen.height - Screen.height * 0.1f, Screen.width, Screen.height * 0.1f),
                  "좌우:A,S 또는 Joystack | 점프:X | 좌우회전:Z,C");

        GUI.contentColor = Color.white;
        GUI.Button(new Rect(Screen.width * 0.03f, Screen.height * 0.75f, Screen.width * 0.3f, Screen.height * 0.05f), "JoyStick : " + mFuncHorizontal.SafeInvoke());
    }
コード例 #5
0
        public static Type TypePopup <T>(GUIRect guiRect, GUIContent label, Type currentType)
        {
            Rect rect = guiRect.GetFieldRect();

            rect = EditorGUI.PrefixLabel(rect, label);
            return(TypePopup <T>(rect, currentType));
        }
コード例 #6
0
        public static void TypePopup <T>(GUIRect guiRect, GUIContent label, ReflectedProperty property)
        {
            Rect rect = guiRect.GetFieldRect();

            rect = EditorGUI.PrefixLabel(rect, label);
            TypePopup <T>(rect, property);
        }
コード例 #7
0
        private void OnGUI()
        {
            if (T17InGameFlow.Instance != null)
            {
                if (!T17InGameFlow.Instance.IsPauseMenuOpen() && Messages.Any(message => !message.ShouldRemove()))
                {
                    var guiRect = new GUIRect(new Rect(0.003f, 0.01f, 0.3f, 0.02f * MaxMessages), GUIAnchor.TopRight, GUICoordSystem.Normalised);
                    var m       = string.Join("\n",
                                              Messages.Reverse().Where(message => !message.ShouldRemove()).Take(MaxMessages).Select(message => message.Text).ToArray());

                    var boxStyle = new GUIStyle(GUI.skin.box)
                    {
                        alignment = TextAnchor.UpperRight, fontSize = 15, normal = { background = _boxTexture, textColor = Color.white }
                    };
                    GUI.Box(guiRect.GetInPixels(Camera.main), m, boxStyle);

                    /*
                     * var index = 0;
                     * foreach (var m in Messages.Reverse().Where(message => !message.ShouldRemove()).Take(MaxMessages))
                     * {
                     *  guiRect = new GUIRect(new Rect(0.005f, 0.01f + 0.02f * index + 0.007f * index, 0.3f, 0.02f),
                     *      GUIAnchor.TopRight, GUICoordSystem.Normalised);
                     *  DrawString(guiRect.GetInPixels(Camera.main), m.Text);
                     *  index++;
                     * }*/
                }
            }
        }
コード例 #8
0
ファイル: GoalDrawer.cs プロジェクト: weichx/SpaceGame
        public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label)
        {
            position = EditorGUI.IndentedRect(position);
            GUIRect guiRect = new GUIRect(position);

            string goalName = property.Type.Name.Replace("Goal", "");

            goalName = $"[{ObjectNames.NicifyVariableName(goalName)}]";

            GUIContent content = EditorGUIX.TempLabel(goalName);

            Rect rect = guiRect.GetFieldRect();

            rect.width *= 0.25f;
            EditorGUIX.Foldout(rect, property, content);
            rect.x    += rect.width;
            rect.width = rect.width * 3f;

            EditorGUIX.PropertyField(rect, property[NameField], GUIContent.none);

            if (property.IsExpanded)
            {
                EditorGUIX.DrawProperties(guiRect, property, SkipList);
                ReorderableListGUI.ListFieldAbsolute(EditorGUI.IndentedRect(guiRect.GetRect()), adapter);
            }
        }
コード例 #9
0
        public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label)
        {
            GUIRect guiRect = new GUIRect();

            guiRect.SetRect(position);

            EditorGUIX.PropertyField(guiRect.GetFieldRect(), property[NameField]);
            EditorGUIX.PropertyField(guiRect.GetFieldRect(), property[ShipCategoryField]);
        }
コード例 #10
0
        public override void Sprawdzanie()
        {
            helper.Update();
            if (GUIRect.Contains(new Point(Mouse.GetState().X, Mouse.GetState().Y)) && Mouse.GetState().LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                if (_metoda != null)
                {
                    _metoda();
                }
            }
            if (CzyEnter == true && text.Length > 0)
            {
                CzyEnter2 = true;
            }
            else
            {
                CzyEnter = false;
            }
            var zmienna = Keyboard.GetState().GetPressedKeys().FirstOrDefault();

            if (zmienna != Keys.None && Regex.IsMatch(zmienna.ToString(), @"[a-zA-Z]"))
            {
                if (helper.IsNewPress(zmienna))
                {
                    if (zmienna == Keys.Back)
                    {
                        if (text.Length > 0)
                        {
                            text = text.Remove(text.Length - 1);
                        }
                    }
                    else if (zmienna == Keys.Enter)
                    {
                        if (text.Length > 0)
                        {
                            CzyEnter2 = true;
                        }
                    }
                    else if (text.Length < 8 && zmienna.ToString().Length == 1)
                    {
                        text += zmienna.ToString();
                    }
                }
            }
            if (CzyEnter2 == true && text.Length > 0)
            {
                text.ToString();
                FileManager.SaveScoreToFile(HighList, text);
            }
        }
コード例 #11
0
        public static void DrawProperties(GUIRect guiRect, ReflectedProperty root, string[] skipList = null)
        {
            List <ReflectedProperty> properties = root.GetChildren();

            for (int i = 0; i < properties.Count; i++)
            {
                ReflectedProperty property = properties[i];
                if (!property.IsHidden && (skipList == null || Array.IndexOf(skipList, property.name) == -1))
                {
                    float height = property.GetPropertyHeight();
                    Internal_PropertyField(guiRect.SliceHeight(height), property, property.GUIContent, false);
                }
            }
        }
コード例 #12
0
    private void OnGUI()
    {
        GUIRect guiRect = new GUIRect();

        guiRect.center = new Vector2(Screen.width * 0.45f, Screen.height * 0.9f);
        guiRect.size   = new Vector2(Screen.width * 0.1f, Screen.height * 0.08f);
        if (mIsPlaying == false &&
            (GUI.Button(guiRect.rect, "START") || Input.GetKeyDown(KeyCode.Q)))
        {
            mIsPlaying = true;
            StartCoroutine(SeqStartStage());
        }

        guiRect.center = new Vector2(Screen.width * 0.55f, Screen.height * 0.9f);
        if (GUI.Button(guiRect.rect, "RESET"))
        {
            OnRestart();
        }
    }
コード例 #13
0
    void OnGUI()
    {
        //GUI.Box(new Rect(Screen.width - 110, 10, 100, 90), "Change Motion");
        //if (GUI.Button(new Rect(Screen.width - 100, 40, 80, 20), "Next"))
        //anim.SetBool("Next", true);
        //if (GUI.Button(new Rect(Screen.width - 100, 70, 80, 20), "Back"))
        //anim.SetBool("Back", true);

        GUIRect rect = new GUIRect();

        rect.size   = new Vector2(Screen.width * 0.2f, Screen.height * 0.1f);
        rect.center = new Vector2(Screen.width * 0.85f, Screen.height * 0.1f);
        if (GUI.Button(rect.rect, "Next"))
        {
            anim.SetBool("Next", true);
        }

        rect.center = new Vector2(Screen.width * 0.85f, Screen.height * 0.2f);
        if (GUI.Button(rect.rect, "Back"))
        {
            anim.SetBool("Back", true);
        }
    }
コード例 #14
0
ファイル: DecisionDrawer.cs プロジェクト: weichx/SpaceGame
        public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label = null)
        {
            if (property[EvaluatorField].Value == null)
            {
                // todo -- context should match the decisions context
                property[EvaluatorField].Value = new Evaluator <EntityContext>();
            }

            GUIRect guiRect = new GUIRect(position);

            EditorGUIX.PropertyField(guiRect, property[NameField]);
            EditorGUIX.TypePopup <DecisionContext>(guiRect, EditorGUIX.TempLabel("Context Type"), property[ContextTypeField]);
            EditorGUIX.PropertyField(guiRect, property[ActionField]);
            EditorGUIX.PropertyField(guiRect, property[ContextCreatorField]);
            EditorGUIX.PropertyField(guiRect, property[EvaluatorField]);

            if (property[ContextTypeField].DidChange)
            {
                property.ApplyChanges();
                Type newContextType = (Type)property[ContextTypeField].Value;
                if (!AssertCompatible(property[ActionField], newContextType))
                {
                    property[ActionField].Value = null;
                }
                if (!AssertCompatible(property[ContextCreatorField], newContextType))
                {
                    property[ContextCreatorField].Value = null;
                }
                if (!AssertCompatible(property[EvaluatorField], newContextType))
                {
                    property[EvaluatorField].SetValueAndCopyCompatibleProperties(
                        EditorReflector.CreateGenericInstance(typeof(Evaluator <>), newContextType)
                        );
                    // todo -- for each consideration, make sure its compatible with new context type
                }
            }
        }
コード例 #15
0
        public static void TypePopup <T>(GUIRect guiRect, ReflectedProperty property)
        {
            Type currentType = (Type)property.Value;

            property.Value = TypePopup <T>(guiRect.GetFieldRect(), currentType);
        }
コード例 #16
0
 public static Type ConstructableTypePopup <T>(GUIRect guiRect, Type currentType)
 {
     return(ConstructableTypePopup <T>(guiRect.GetFieldRect(), currentType));
 }
コード例 #17
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (graphTexture == null)
            {
                graphTexture = new Texture2D(1, 1, TextureFormat.RGBA32, true);
            }

            curve = SerializedPropertyUtil.GetTargetObjectOfProperty(property) as ResponseCurve ?? new ResponseCurve();
            GUIRect rect = new GUIRect(position);

            isCurveShown = curve.__editorOnlyFoldout__ = EditorGUI.Foldout(rect.GetFieldRect(), curve.__editorOnlyFoldout__, label.text);

            GUIStyle style = new GUIStyle(GUI.skin.box);

            if (!isCurveShown)
            {
                DrawGraph(64, 32);
                GUIContent content = new GUIContent();
                content.text    = curve.DisplayString;
                content.image   = graphTexture;
                style.alignment = TextAnchor.MiddleLeft;
                GUI.Box(rect.GetFieldRect(2), content, style);
                return;
            }

            GUIRect[] splits = rect.SplitHorizontal(0.5f);
            GUIRect   left   = splits[0];
            GUIRect   right  = splits[1];

            DrawGraph(right.GetRect().width, right.GetRect().height);

            GUIContent graphContent = new GUIContent();

            graphContent.image = graphTexture;
            GUI.Box(right.GetRect(), graphContent, style);
            float oldWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 100;

            DrawerUtil.PushIndentLevel(1);
            EditorGUI.BeginChangeCheck();
            {
                EditorGUI.PropertyField(left.GetFieldRect(), property.FindPropertyRelative("curveType"));
                EditorGUI.PropertyField(left.GetFieldRect(), property.FindPropertyRelative("slope"));
                EditorGUI.PropertyField(left.GetFieldRect(), property.FindPropertyRelative("exp"));
                EditorGUI.PropertyField(left.GetFieldRect(), property.FindPropertyRelative("vShift"));
                EditorGUI.PropertyField(left.GetFieldRect(), property.FindPropertyRelative("hShift"));
                EditorGUI.PropertyField(left.GetFieldRect(), property.FindPropertyRelative("threshold"));
                GUIRect   lineRect      = new GUIRect(left.GetFieldRect());
                GUIRect[] lineRectParts = lineRect.SplitHorizontal(0.5f);
                EditorGUI.PropertyField(lineRectParts[0].GetRect(), property.FindPropertyRelative("invert"));


                if (GUI.Button(lineRectParts[1].GetRect(), "Reset Curve"))
                {
                    property.FindPropertyRelative("curveType").intValue   = (int)ResponseCurveType.Polynomial;
                    property.FindPropertyRelative("slope").floatValue     = 1f;
                    property.FindPropertyRelative("exp").floatValue       = 1f;
                    property.FindPropertyRelative("vShift").floatValue    = 0f;
                    property.FindPropertyRelative("hShift").floatValue    = 0f;
                    property.FindPropertyRelative("threshold").floatValue = 0f;
                    property.FindPropertyRelative("invert").boolValue     = false;
                }
            }
            DrawerUtil.PopIndentLevel();
            EditorGUIUtility.labelWidth = oldWidth;
            if (EditorGUI.EndChangeCheck())
            {
                property.serializedObject.ApplyModifiedProperties();
            }
        }
コード例 #18
0
        public static void PropertyField(GUIRect rect, ReflectedProperty property, GUIContent label = null)
        {
            float height = property.Drawer.GetPropertyHeight(property);

            Internal_PropertyField(rect.SliceHeight(height), property, label ?? property.GUIContent, false);
        }
コード例 #19
0
    private void OnGUI()
    {
        float width  = Screen.width;
        float height = Screen.height;

        GUIRect guiRect = new GUIRect();
        Vector2 btnSize = new Vector2(width * 0.65f, height * 0.05f);


        guiRect.center        = new Vector2(width * 0.25f, height * 0.03f);
        guiRect.size          = new Vector2(width * 0.4f, height * 0.03f);
        LoadedAssetBundleName = GUI.TextField(guiRect.rect, LoadedAssetBundleName);
        guiRect.center        = new Vector2(width * 0.75f, height * 0.03f);
        LoadAssetName         = GUI.TextField(guiRect.rect, LoadAssetName);

        guiRect.center = new Vector2(width * 0.5f, height * 0.1f);
        guiRect.size   = btnSize;
        if (GUI.Button(guiRect.rect, "Load AssetBundle"))
        {
            AssetBundle assetBundle = null;
            if (CachedAssetBundle.TryGetValue(LoadedAssetBundleName, out assetBundle))
            {
                GameObject pfGO = assetBundle.LoadAsset <GameObject>(LoadAssetName);
                LoadInstanceList.Add(Instantiate(pfGO));
            }
        }
        guiRect.center = new Vector2(width * 0.5f, height * 0.15f);
        if (GUI.Button(guiRect.rect, "Next Scene"))
        {
            AssetBundle assetBundle = null;
            if (CachedAssetBundle.TryGetValue(LoadedAssetBundleName, out assetBundle))
            {
                UnityEngine.SceneManagement.SceneManager.LoadScene("CSceneEmpty");
            }
        }
        guiRect.center = new Vector2(width * 0.5f, height * 0.2f);
        if (GUI.Button(guiRect.rect, "Unload AssetBundles"))
        {
            foreach (var bundle in CachedAssetBundle)
            {
                bundle.Value.Unload(false);
            }
        }



        guiRect.center = new Vector2(width * 0.5f, height * 0.5f);
        guiRect.size   = btnSize;
        if (GUI.Button(guiRect.rect, "Load All Asset Bundle"))
        {
            if (isLoading == false)
            {
                StartCoroutine(LoadAllAssetBundles());
            }
        }
        guiRect.center = new Vector2(width * 0.5f, height * 0.6f);
        if (GUI.Button(guiRect.rect, "Sample Download"))
        {
            StartCoroutine(LoadSampleAssetBundle());
        }

        guiRect.center = new Vector2(width * 0.5f, height * 0.7f);
        if (GUI.Button(guiRect.rect, "Destroy Objects"))
        {
            foreach (var obj in LoadInstanceList)
            {
                Destroy(obj);
            }
            LoadInstanceList.Clear();
        }
        guiRect.center = new Vector2(width * 0.5f, height * 0.8f);
        if (GUI.Button(guiRect.rect, "Remove Cache"))
        {
            bool result = Caching.CleanCache();
            Debug.Log("result : " + result);
        }
        guiRect.center = new Vector2(width * 0.5f, height * 0.9f);
        if (GUI.Button(guiRect.rect, "GC Collect"))
        {
            System.GC.Collect();
        }
    }
コード例 #20
0
ファイル: M_GUICamera.cs プロジェクト: wolvtodd/MARK-II
    /* *
     * 初期化に関するメソッド
     * */

    //unityを起動するときに実行します
    void Awake()
    {
        SingletonThisClass();
        CURRENT_GUI_RECT = GUI_RECT(transform.position);
    }
コード例 #21
0
ファイル: M_GUICamera.cs プロジェクト: wolvtodd/MARK-II
 /* *
  * 初期化に関するメソッド
  * */
 //unityを起動するときに実行します
 void Awake()
 {
     SingletonThisClass();
     CURRENT_GUI_RECT = GUI_RECT(transform.position);
 }
コード例 #22
0
        public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label = null)
        {
            guiRect.SetRect(position);
            if (style == null)
            {
                style = new GUIStyle(GUI.skin.box);
            }

            if (graphTexture == null)
            {
                graphTexture = new Texture2D(1, 1, TextureFormat.RGBA32, true);
            }

            curve = (ResponseCurve)property.Value ?? new ResponseCurve();

            if (property.IsExpanded)
            {
                EditorGUIX.Foldout(guiRect, property);
            }

            if (!property.IsExpanded)
            {
                DrawGraph(64, 32);
                GUIContent content = EditorGUIX.TempLabel(curve.ShortDisplayString);
                content.image   = graphTexture;
                style.alignment = TextAnchor.MiddleLeft;
                GUI.Box(guiRect.GetFieldRect(2), content, style);
                content.image = null;
                if (Event.current.type == EventType.MouseDown)
                {
                    if (position.Contains(Event.current.mousePosition))
                    {
                        property.IsExpanded = true;
                        Event.current.Use();
                    }
                }
                return;
            }

            GUIRect[] splits = guiRect.SplitHorizontal(0.5f);
            GUIRect   left   = splits[0];
            GUIRect   right  = splits[1];

            DrawGraph(right.GetRect().width, right.GetRect().height);

            GUIContent graphContent = EditorGUIX.TempLabel(string.Empty);

            graphContent.image = graphTexture;
            GUI.Box(right.GetRect(), graphContent, style);
            graphContent.image = null;
            float oldWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 100;

            EditorGUIX.PropertyField(left.GetFieldRect(), property.FindProperty("curveType"));
            EditorGUIX.PropertyField(left.GetFieldRect(), property.FindProperty("slope"));
            EditorGUIX.PropertyField(left.GetFieldRect(), property.FindProperty("exp"));
            EditorGUIX.PropertyField(left.GetFieldRect(), property.FindProperty("vShift"));
            EditorGUIX.PropertyField(left.GetFieldRect(), property.FindProperty("hShift"));
            EditorGUIX.PropertyField(left.GetFieldRect(), property.FindProperty("threshold"));

            Rect lineRect   = left.GetFieldRect();
            Rect toggleRect = new Rect(lineRect)
            {
                width = EditorGUIUtility.labelWidth + 16f
            };
            Rect selectRect = new Rect(lineRect)
            {
                x     = lineRect.x + toggleRect.width,
                width = lineRect.width - toggleRect.width
            };

            EditorGUIX.PropertyField(toggleRect, property.FindProperty("invert"));

            int idx = EditorGUI.Popup(selectRect, 0, presetCurveNames);

            property.Value = GetPreset(presetCurveNames[idx], curve);

            EditorGUIUtility.labelWidth = oldWidth;
            property.ApplyChanges();
        }