Beispiel #1
0
        public static bool InitFloatieNonVR()
        {
            GameObject g = GameObject.Find("[NonVRFloatie]");

            if (g == null)
            {
                if (!floatieSceneLoaded)
                {
                    SceneManager.LoadScene("non_vr_ui_floatie", LoadSceneMode.Additive);
                    floatieSceneLoaded = true;
                    Main.mod.Logger.Log("Called load of non VR float scene.");
                }
                else
                {
                    Main.mod.Logger.Log("Could not find the non VR float.");
                }
                return(false);
            }
            g = GameObject.Instantiate(g); // The tutorial sequence destroys non VR floaties, so make our own.

            floatieNonVR = g.GetComponentInChildren <Image>(true)?.gameObject;
            if (floatieNonVR == null)
            {
                return(false);
            }
            Main.mod.Logger.Log("Found the non VR float.");

            floatieNonVRText = floatieNonVR.GetComponentInChildren <TextMeshProUGUI>(true);
            if (floatieNonVRText == null)
            {
                return(false);
            }
            Main.mod.Logger.Log("Found the non VR text.");

            floatieNonVRLine = floatieNonVR.GetComponentInChildren <TutorialLineNonVR>(true);
            if (floatieNonVRLine == null)
            {
                return(false);
            }
            Main.mod.Logger.Log("Found the non VR line.");
            return(true);
        }
Beispiel #2
0
        public static bool Initialize()
        {
            if (pointerTexture == null)
            {
                pointerTexture = new Texture2D(256, 1);
                // Note: ImageConversion.LoadImage automatically invokes Apply.
                ImageConversion.LoadImage(pointerTexture, File.ReadAllBytes(Main.mod.Path + "tutorial_UI_gradient_opaque.png"));
            }

            if (VRManager.IsVREnabled())
            {
                ChangeFloatieText        = ChangeFloatieTextVR;
                HideFloatie              = HideFloatVR;
                ShowFloatie              = ShowFloatVR;
                UpdateAttentionTransform = UpdateAttentionTransformVR;
            }
            else if (LoadingScreenManager.IsLoading || !WorldStreamingInit.IsLoaded ||
                     !SingletonBehaviour <InventoryStartingItems> .Instance.itemsLoaded)
            {
                return(false);
            }
            else
            {
                GameObject g = GameObject.Find("[NonVRFloatie]");
                if (g == null)
                {
                    SceneManager.LoadScene("non_vr_ui_floatie", LoadSceneMode.Additive);
                    g = GameObject.Find("[NonVRFloatie]");
                }

                if (g == null)
                {
                    return(false);
                }
                g = GameObject.Instantiate(g); // The tutorial sequence destroys non VR floaties, so make our own.

                Image i = g.GetComponentInChildren <Image>(true);
                if (i == null)
                {
                    return(false);
                }
                floatieNonVR = i.gameObject;
                Main.mod.Logger.Log("Found the non VR float.");

                floatieNonVRText = floatieNonVR.GetComponentInChildren <TextMeshProUGUI>(true);
                if (floatieNonVRText == null)
                {
                    return(false);
                }
                Main.mod.Logger.Log("Found the non VR text.");

                floatieNonVRLine = floatieNonVR.GetComponentInChildren <TutorialLineNonVR>(true);
                if (floatieNonVRLine == null)
                {
                    return(false);
                }
                Main.mod.Logger.Log("Found the non VR line.");

                ChangeFloatieText        = ChangeFloatieTextNonVR;
                HideFloatie              = HideFloatNonVR;
                ShowFloatie              = ShowFloatNonVR;
                UpdateAttentionTransform = UpdateAttentionTransformNonVR;
            }

            Main.mod.Logger.Log("Floaties have been set up.");
            return(true);
        }