示例#1
0
        void DoMenu(int WindowID)
        {
            GUILayout.Box("", GUILayout.Height(295), GUILayout.Width(300));
            EditorGUITools.DrawRect(new Rect(0, 0, 350, 350), Color.black);
            EditorGUITools.DrawRect(new Rect(5, 5, 310, 315), Color.gray);

            if ((DateTime.Now - lastRendTime).TotalMilliseconds >= Settings.Radar.RadarRefreshRate)
            {
                GetRadarPlayers();
                lastRendTime = DateTime.Now;
            }

            for (int i = 0; i < s_x.Count; i++)
            {
                EditorGUITools.DrawRect(new Rect(s_x[i], s_z[i], (300 / Settings.Radar.RadarRange), (300 / Settings.Radar.RadarRange)), Color.red);
            }

            if (Settings.Radar.RadarStatic)
            {
                if ((DateTime.Now - lastPRendTime).TotalMilliseconds >= Settings.Radar.RadarRefreshRate)
                {
                    Vector2 CenterOffset = GetOffsetFromCenter(new Vector2(150, 150));
                    otri1 = GetOffsetFromCenter(tri1);
                    otri2 = GetOffsetFromCenter(tri2);
                    otri3 = GetOffsetFromCenter(tri3);
                    double angle_y = Math.Round(MainCamera.instance.transform.eulerAngles.y, 2);
                    ntri1         = Utils.RotatePoint(otri1, CenterOffset, angle_y);
                    ntri2         = Utils.RotatePoint(otri2, CenterOffset, angle_y);
                    ntri3         = Utils.RotatePoint(otri3, CenterOffset, angle_y);
                    lastPRendTime = DateTime.Now;
                }
                Utils.DrawLine(ntri1, ntri2, Color.blue, 2);
                Utils.DrawLine(ntri2, ntri3, Color.blue, 2);
                Utils.DrawLine(ntri3, ntri1, Color.blue, 2);
            }
            else
            {
                Utils.DrawLine(otri1, otri2, Color.blue, 2);
                Utils.DrawLine(otri2, otri3, Color.blue, 2);
                Utils.DrawLine(otri3, otri1, Color.blue, 2);
            }
            GUI.DragWindow();
        }
示例#2
0
        void DoMenu(int windowID)
        {
            if (cam_obj == null || subCam == null)
            {
                cam_obj = new GameObject();
                subCam  = cam_obj.AddComponent <Camera>();
                cam_obj.AddComponent <GUILayer>();
                cam_obj.transform.position = MainCamera.instance.gameObject.transform.position;
                cam_obj.transform.rotation = MainCamera.instance.gameObject.transform.rotation;
                cam_obj.transform.Rotate(0, 180, 0);
                subCam.transform.SetParent(Camera.main.transform, true);
                subCam.layerCullDistances = MainCamera.instance.layerCullDistances;
                subCam.layerCullSpherical = MainCamera.instance.layerCullSpherical;
                subCam.tag     = "MainCamera";
                subCam.enabled = true;
                subCam.rect    = new Rect(0.6f, 0.6f, 0.4f, 0.4f);
                subCam.depth   = 99;
            }
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label("Rear View Camera");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            float x, y, w, h;

            x           = (menu.x + 5) / Screen.width;
            y           = (menu.y + 5) / Screen.height;
            w           = (menu.width - 10) / Screen.width;
            h           = (menu.height - 10) / Screen.height;
            y           = 1 - y;
            y          -= h;
            subCam.rect = new Rect(x, y, w, h);

            EditorGUITools.DrawRect(new Rect(0, 0, menu.width, 5), Color.black);
            EditorGUITools.DrawRect(new Rect(0, 0, 5, menu.height), Color.black);
            EditorGUITools.DrawRect(new Rect(0, 0 + (menu.height - 5), menu.width, 5), Color.black);
            EditorGUITools.DrawRect(new Rect(0 + (menu.width - 5), 0, 5, menu.height), Color.black);

            GUI.DragWindow();
        }