Beispiel #1
0
    /// <summary>
    /// The one and only OnGUI method that invokes all the RenderGUI methods of all registered KGFIGui2D objects
    /// </summary>
    protected void OnGUI()
    {
        float aScaleFactor = KGFScreen.GetScaleFactor2D();

        GUIUtility.ScaleAroundPivot(new Vector2(aScaleFactor, aScaleFactor), Vector2.zero);
        foreach (KGFIGui2D aGui2D in itsGUIs)
        {
            aGui2D.RenderGUI();
        }
        GUI.matrix = Matrix4x4.identity;
    }
Beispiel #2
0
    public static Vector3 GetMousePositionDisplay()
    {
        CheckInstance();
        if (itsInstance == null)
        {
            return(Vector3.zero);
        }

        float   anX            = Input.mousePosition.x * KGFScreen.GetScaleFactor3D();
        float   anY            = Screen.height - (Input.mousePosition.y * KGFScreen.GetScaleFactor3D());
        Vector3 aMousePosition = new Vector3(anX, anY, Input.mousePosition.z);

        return(aMousePosition);
    }
Beispiel #3
0
 /// <summary>
 /// This method is called from Unity3D Engine when the script instance is being loaded.
 /// </summary>
 protected void Awake()
 {
     if (itsInstance == null)
     {
         itsInstance = this;
         itsInstance.Init();
     }
     else
     {
         if (itsInstance != this)
         {
             UnityEngine.Debug.Log("there is more than one KFGDebug instance in this scene. please ensure there is always exactly one instance in this scene");
             Destroy(gameObject);
         }
         return;
     }
 }
Beispiel #4
0
    private static void CheckInstance()
    {
        // check if the cheat module is already activated
        if (itsInstance == null)
        {
            UnityEngine.Object theObject = UnityEngine.Object.FindObjectOfType(typeof(KGFScreen));

            if (theObject != null)
            {
                itsInstance = theObject as KGFScreen;
                itsInstance.Init();
            }
            else
            {
                if (!itsAlreadyChecked)
                {
                    UnityEngine.Debug.LogError("KGFScreen is not running. Make sure that there is an instance of the KGFScreen prefab in the current scene.");
                    itsAlreadyChecked = true;
                }
            }
        }
    }
Beispiel #5
0
    public static Vector3 GetMousePosition2D()
    {
        CheckInstance();
        if (itsInstance == null)
        {
            return(Vector3.zero);
        }

        if (GetResolutionMode3D() == GetResolutionMode2D())             //both modes are the same
        {
            return(Input.mousePosition);
        }
        else if (GetResolutionMode2D() == eResolutionMode.eNative && GetResolutionMode3D() == eResolutionMode.eAutoAdjust)
        {
            return(Input.mousePosition * KGFScreen.GetScaleFactor3D());
        }
        else if (GetResolutionMode2D() == eResolutionMode.eAutoAdjust && GetResolutionMode3D() == eResolutionMode.eNative)
        {
            return(Input.mousePosition / KGFScreen.GetScaleFactor2D());
        }

        return(Input.mousePosition);
    }
Beispiel #6
0
 private void OnPostRender()
 {
     KGFScreen.BlitToScreen();
 }
Beispiel #7
0
    private static void CheckInstance()
    {
        // check if the cheat module is already activated
        if(itsInstance == null)
        {
            UnityEngine.Object theObject = UnityEngine.Object.FindObjectOfType(typeof(KGFScreen));

            if(theObject != null)
            {
                itsInstance = theObject as KGFScreen;
                itsInstance.Init();
            }
            else
            {
                if(!itsAlreadyChecked)
                {
                    UnityEngine.Debug.LogError("KGFScreen is not running. Make sure that there is an instance of the KGFScreen prefab in the current scene.");
                    itsAlreadyChecked = true;
                }
            }
        }
    }
Beispiel #8
0
 /// <summary>
 /// This method is called from Unity3D Engine when the script instance is being loaded.
 /// </summary>
 protected void Awake()
 {
     if (itsInstance == null)
     {
         itsInstance = this;
         itsInstance.Init();
     }
     else
     {
         if(itsInstance != this)
         {
             UnityEngine.Debug.Log("there is more than one KFGDebug instance in this scene. please ensure there is always exactly one instance in this scene");
             Destroy(gameObject);
         }
         return;
     }
 }