예제 #1
0
        public static bool Prefix(ref CinematicModeTrigger __instance, GUIHand hand)
        {
            bool   bLog     = false;
            string handText = __instance.handText;

            if (msgTimer > 0)
            {
                msgTimer--;
            }
            else
            {
                bLog = bDebug && Logger.DebugLogsEnabled;
                if (bLog)
                {
                    if (bLog)
                    {
                        ErrorMessage.AddMessage($"CinematicModeTrigger_OnHandHover_Patch.Prefix() running, handText = {handText}");
                    }
                    msgTimer = 30;
                }
            }

            if (handText != "EnterCyclops" && handText != "LeaveCyclops")
            {
                return(true);
            }

            if (!__instance.showIconOnHandHover)
            {
                if (bLog)
                {
                    ErrorMessage.AddMessage($"showIconOnHandHover == false");
                }
                return(true);
            }
            if (PlayerCinematicController.cinematicModeCount > 0)
            {
                if (bLog)
                {
                    ErrorMessage.AddMessage($"cinematicModeCount > 0");
                }
                return(true);
            }
            if (string.IsNullOrEmpty(__instance.handText))
            {
                if (bLog)
                {
                    ErrorMessage.AddMessage($"string handText IsNullOrEmpty");
                }
                return(true);
            }

            // transform.parent will be the CyclopsMeshAnimated; we need to go up one more level to get the Cyclops-MainPrefab, at which point we can get at the SubRoot
            UnityEngine.Transform transformGrandparent = __instance.transform.parent.parent;
            SubRoot subRoot = null;

            if (transformGrandparent != null)
            {
                subRoot = transformGrandparent.GetComponent <SubRoot>();
            }
            else
            {
                if (bLog)
                {
                    ErrorMessage.AddMessage($"Couldn't get transformRoot in __instance");
                }
                return(true);
            }

            if (subRoot == null)
            {
                if (bLog)
                {
                    ErrorMessage.AddMessage($"Couldn't get SubRoot in transformRoot");
                }
                return(true);
            }

            string subName  = subRoot.GetSubName();
            string language = Language.main.GetCurrentLanguage();

            //if (bLog) ErrorMessage.AddMessage($"calling TryGetVehiclePrompt with parameters initialKey='{handText}', language='{language}', VehicleName='{subName}'");
            if (Main.TryGetVehiclePrompt(handText, Language.main.GetCurrentLanguage(), subName, out string prompt))
            {
                if (bLog)
                {
                    ErrorMessage.AddMessage($"TryGetVehiclePrompt returned true with value for prompt of '{prompt}'");
                }
#if SUBNAUTICA_STABLE
                HandReticle.main.SetInteractText(prompt);
#elif BELOWZERO
                HandReticle.main.SetText(HandReticle.TextType.Hand, prompt, true);
#endif
                HandReticle.main.SetIcon(HandReticle.IconType.Hand, 1f);
                return(false);
            }
            else
            {
                if (bLog)
                {
                    ErrorMessage.AddMessage($"TryGetVehiclePrompt returned false");
                }
            }

            return(true);
        }
예제 #2
0
        internal static BaseManager FindManager(SubRoot subRoot)
        {
            //if (!subRoot.isBase) return null; //Disabled to allow Cyclops Operation

            QuickLogger.Debug($"Processing SubRoot = {subRoot.GetInstanceID()} || Name {subRoot.GetSubName()}");

            var pre = subRoot.gameObject.GetComponent <PrefabIdentifier>();

            var manager = Managers.Find(x => x.InstanceID == subRoot.GetInstanceID() && x.Habitat == subRoot);

            if (manager == null)
            {
                QuickLogger.Debug("No manager found on base");
            }

            return(manager ?? CreateNewManager(subRoot));
        }
        internal static BaseManager FindManager(SubRoot subRoot)
        {
            QuickLogger.Debug($"Processing SubRoot = {subRoot.GetInstanceID()} || Name {subRoot.GetSubName()}");
            var g       = FindManager(subRoot.gameObject.GetComponentInChildren <PrefabIdentifier>()?.Id);
            var manager = Managers.Find(x => x.InstanceID == g?.InstanceID && x.Habitat == subRoot);

            return(manager ?? CreateNewManager(subRoot));
        }