Esempio n. 1
0
    public void OnGUI()
    {
        RenderAdaptiveMarkers.DrawGUIStatic();

        if (!RenderEnabled || WarningPosition.Count <= 0)
        {
            return;
        }

        if (PreviewTex.IsPreview)
        {
            return;
        }

        if (MapLuaParser.LoadingMapProcess || MapLuaParser.SavingMapProcess)
        {
            return;
        }

        Camera MainCam = CameraControler.Current.Cam;
        Rect   CamRect = MainCam.pixelRect;
        Rect   UiRect  = new Rect(CamRect.x, CamRect.y + (Screen.height - CamRect.height), CamRect.width, CamRect.height);

        GUI.BeginScrollView(UiRect, Vector2.zero, new Rect(0, (Screen.height - CamRect.height), CamRect.width, CamRect.height), false, false);

        //GUI.Label(new Rect(500, 500, 100, 50), "Test");

        //Color LastColor = GUI.contentColor;
        //GUI.contentColor = LabelColor;
        HashSet <MarkerWarning> .Enumerator ListEnum = WarningPosition.GetEnumerator();
        while (ListEnum.MoveNext())
        {
            MarkerWarning Current = ListEnum.Current;

            DrawGuiLabel(MainCam, CamRect, Current.Marker, Current.Log, LabelStyle);
        }
        ListEnum.Dispose();
        //GUI.contentColor = LastColor;

        GUI.EndScrollView();
    }
Esempio n. 2
0
    public void OnGUI()
    {
        RenderAdaptiveMarkers.DrawGUIStatic();

        if (BP.Footprint.x == 0 && BP.Footprint.y == 0)
        {
            return;
        }

        if (PreviewTex.IsPreview)
        {
            return;
        }

        if (MapLuaParser.LoadingMapProcess || MapLuaParser.SavingMapProcess)
        {
            return;
        }

        Camera MainCam = CameraControler.Current.Cam;
        Rect   CamRect = MainCam.pixelRect;
        Rect   UiRect  = new Rect(CamRect.x, CamRect.y + (Screen.height - CamRect.height), CamRect.width, CamRect.height);

        GUI.BeginScrollView(UiRect, Vector2.zero, new Rect(0, (Screen.height - CamRect.height), CamRect.width, CamRect.height), false, false);

        Vector3 MapMaxPoint = ScmapEditor.ScmapPosToWorld(
            new Vector3(MapLuaParser.Current.ScenarioLuaFile.Data.Size[0], 0, MapLuaParser.Current.ScenarioLuaFile.Data.Size[1])
            );

        Vector2 BorderOffsetFootprint = new Vector2(BorderOffset + BP.Footprint.x * 0.05f, BorderOffset + BP.Footprint.y * 0.05f);

        //GUI.Label(new Rect(500, 500, 100, 50), "Test");

        //Color LastColor = GUI.contentColor;
        //GUI.contentColor = LabelColor;
        var ListEnum = Instances.GetEnumerator();

        while (ListEnum.MoveNext())
        {
            Vector3 LocalPos = ListEnum.Current.LocalToWorldMatrix.GetColumn(3);

            if (LocalPos.x < BorderOffsetFootprint.x)
            {
                LocalPos.x -= BP.Footprint.x * 0.05f;
                DrawGuiLabel(MainCam, CamRect, LocalPos, BuildingEdgeWarning, RenderMarkersWarnings.Instance.LabelStyle);
            }
            else if (LocalPos.z > -BorderOffsetFootprint.y)
            {
                LocalPos.z += BP.Footprint.y * 0.05f;
                DrawGuiLabel(MainCam, CamRect, LocalPos, BuildingEdgeWarning, RenderMarkersWarnings.Instance.LabelStyle);
            }
            else if (LocalPos.x > MapMaxPoint.x - BorderOffsetFootprint.x)
            {
                LocalPos.x += BP.Footprint.x * 0.05f;
                DrawGuiLabel(MainCam, CamRect, LocalPos, BuildingEdgeWarning, RenderMarkersWarnings.Instance.LabelStyle);
            }
            else if (LocalPos.z < MapMaxPoint.z + BorderOffsetFootprint.y)
            {
                LocalPos.z -= BP.Footprint.y * 0.05f;
                DrawGuiLabel(MainCam, CamRect, LocalPos, BuildingEdgeWarning, RenderMarkersWarnings.Instance.LabelStyle);
            }
        }
        ListEnum.Dispose();

        GUI.EndScrollView();
    }