Esempio n. 1
0
        public static void Draw_GameObj_Bounds(GameObject obj)
        {
            if (obj == null)
            {
                return;
            }
            RectTransform trans = (obj.transform as RectTransform);

            Rect area = Util.Get_Unity_UI_Object_Area(obj);

            GL.Color(uiControl.color_purple);
            DebugUI.Draw_Rect(area);

            GL.Color(uiControl.color_orange);
            DebugUI.Draw_Point(Util.Get_Unity_UI_Object_AnchorPos(trans.gameObject));
        }
Esempio n. 2
0
        void OnGUI()
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }
            //GL.PushMatrix();

            if (MaterialHelper.mat_line.SetPass(0))
            {
                //DebugUI.DEBUG_LINE_MAT.SetPass(0);
                GL.Begin(GL.LINES);
                GL.Color(uiControl.color_purple);
                DebugUI.Draw_GameObj_Bounds(base.gameObject);
                GL.End();
            }
        }
        internal static void Draw_Debug_Outlines()
        {
            GL.Begin(GL.LINES);
            foreach (uiControl control in uiControl.ALL.Values)
            {
                Rect area      = control.absArea;
                bool DrawInner = false;
                if (DEBUG_DRAW_MODE == uiDebugDrawMode.SELECTED_ONLY)
                {
                    if (control != uiControl.debug_current_mouse_over)
                    {
                        continue;
                    }
                    // Draw all areas of the selected control

                    GL.Color(blue_trans);
                    DebugUI.Draw_Rect(control.internalToAbsolute(control.inner_area));

                    GL.Color(purple_trans);
                    DebugUI.Draw_Rect(control.internalToAbsolute(control.draw_area));

                    GL.Color(white_trans);
                    //DebugUI.Draw_Rect(control.absArea);
                    DebugUI.Draw_Rect(control.internalToAbsolute(control.Area));

                    /*
                     * GL.Color(yellow_trans);
                     * DebugUI.Draw_Rect(control.internalToAbsolute(control.content_area));
                     */
                    GL.Color(Color.clear);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.ACTIVE_ONLY)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(white_trans);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.BORDER_AREAS)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(yellow_trans);
                    area = control.internalToAbsolute(control.border_area);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.DRAW_AREAS)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(purple_trans);
                    area = control.internalToAbsolute(control.draw_area);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.INNER_AREAS)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(blue_trans);
                    area = control.internalToAbsolute(control.inner_area);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.ACTIVE_AND_INACTIVE)
                {
                    if (control.isVisible)
                    {
                        GL.Color(Color.white);
                    }
                    else
                    {
                        GL.Color(white_dark);
                    }
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.HIGHLIGHT_PARENTS)
                {
                    if (control.isParent)
                    {
                        if (control.isVisible)
                        {
                            GL.Color(Color.white);
                        }
                        else
                        {
                            GL.Color(white_dark);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.HIGHLIGHT_PARENT_INNER_AREAS)
                {
                    if (control.isParent)
                    {
                        DrawInner = true;
                        if (control.isVisible)
                        {
                            GL.Color(Color.red);
                        }
                        else
                        {
                            GL.Color(red_dark);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }

                if (area.x > area.xMax || area.y > area.yMax)
                {
                    GL.Color(grey_dark);
                }
                DebugUI.Draw_Rect(area);

                if (DrawInner)
                {
                    if (control.isVisible)
                    {
                        GL.Color(Color.blue);
                    }
                    else
                    {
                        GL.Color(blue_dark);
                    }

                    if (control.absInnerArea.x > control.absInnerArea.xMax || control.absInnerArea.y > control.absInnerArea.yMax)
                    {
                        GL.Color(Color.black);
                    }
                    DebugUI.Draw_Rect(control.absInnerArea);
                }
            }

            if (uiControl.debug_last_consumer_click != null)
            {
                GL.Color(Color.green);
                DebugUI.Draw_Rect(uiControl.debug_last_consumer_click.absArea);
            }

            if (uiControl.debug_current_mouse_over != null && DEBUG_DRAW_MODE != uiDebugDrawMode.SELECTED_ONLY)
            {
                GL.Color(Color.yellow);
                DebugUI.Draw_Rect(uiControl.debug_current_mouse_over.absArea);
            }

            GL.End();
            GL.Color(Color.white);// Always set the GL color back to white before returning from any debug drawing routine!
        }
Esempio n. 4
0
        public static void init(string hash)
        {
            lock (locker)
            {
                if (Loader.Config != null)
                {
                    return;
                }
                //Application.stackTraceLogType = StackTraceLogType.Full;
                Logging.Logger.Begin(Path.Combine(Application.dataPath, "plugins.log"));

                Stopwatch timer = new Stopwatch();
                timer.Start();

                if (!Loader.Load_Config_Stream())
                {
                    return;
                }

                try
                {
                    DebugHud.Init();
                    TextureHelper.Setup();
                    MaterialHelper.Setup();
                    SiscosHooks.Setup();
                    PluginLoader_Watermark.Setup();
                    MainMenu.Setup();
                    DebugUI.Setup();

                    Setup_Update_Helper();
                    bool ok = Verify_PluginLoader_Hash(hash);
                    if (!ok)
                    {
                        return;
                    }

                    IN_LOADING_PHASE = true;
                    Setup_Plugin_Dir();

                    Check_For_Updates();

                    Setup_Assembly_Resolver();
                    Upgrades.Setup();
                    Assemble_Plugin_List();
                    Load_Config();
                    IN_LOADING_PHASE = false;
                    ResourceExt.map_SR_Icons();

                    plugin_updater = uiControl.Create <Plugin_Update_Viewer>();// This control manages itself and is only able to become visible under certain conditions which it will control. Therefore it needs no var to track it.
                    plugin_updater.Show();

                    dev_tools = uiControl.Create <DevMenu>();
                    //dev_tools.Show();
                    //dev_tools.onShown += (uiWindow w) => { GameTime.Pause(); };
                    //dev_tools.onHidden += (uiWindow w) => { GameTime.Unpause(); };

                    //Misc_Experiments.Find_Common_Classes_For_Idents(new HashSet<Identifiable.Id> { Identifiable.Id.PINK_RAD_LARGO });
                }
                catch (Exception ex)
                {
                    SLog.Error("Exception during PluginLoader initialization!");
                    SLog.Error(ex);
                }
                finally
                {
                    timer.Stop();
                    SLog.Debug("Plugin Loader initialized! Took: {0}ms", timer.ElapsedMilliseconds);
                }
            }
        }