Exemplo n.º 1
0
 public static void Initialize()
 {
     pointerTexture = new Texture2D(256, 1);
     // Note: ImageConversion.LoadImage automatically invokes Apply.
     ImageConversion.LoadImage(pointerTexture, File.ReadAllBytes(Main.mod.Path + "tutorial_UI_gradient_opaque.png"));
     // Solely based on command line args, so fine to init ASAP.
     if (VRManager.IsVREnabled())
     {
         ChangeFloatieText        = ChangeFloatieTextVR;
         HideFloatie              = HideFloatVR;
         ShowFloatie              = ShowFloatVR;
         UpdateAttentionTransform = UpdateAttentionTransformVR;
     }
     else
     {
         ChangeFloatieText        = ChangeFloatieTextNonVR;
         HideFloatie              = HideFloatNonVR;
         ShowFloatie              = ShowFloatNonVR;
         UpdateAttentionTransform = UpdateAttentionTransformNonVR;
     }
 }
Exemplo n.º 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);
        }