Exemplo n.º 1
0
        private static void WaitPointDataChangedHook(Base __instance, Base.WaitPointData value)
        {
            // wpData is null when the character is still walking to the current action location
            if (value == null)
            {
                return;
            }

            if (__instance is NPC npc)
            {
                if (npc.isOnanism && _notifyMast.Value || npc.isLesbian && _notifyLesb.Value)
                {
                    try
                    {
                        if (StoreApi.GetItemAmountBought(MoreShopItemsPlugin.DetectorItemId) > 0)
                        {
                            var mapNo = __instance.mapNo;
                            //if (ActionScene.initialized && ActionScene.instance.Player.mapNo != mapNo)
                            if (ActionScene.instance.Map.infoDic.TryGetValue(mapNo, out var param))
                            {
                                InformationUI.SetAsync(string.Format(_infoTextPrefix, param.DisplayName), InformationUI.Mode.Normal).Forget();
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        UnityEngine.Debug.LogException(e);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add topic to player's topic inventory/stock. Does nothing if the topic doesn't exist in <see cref="ActionScene.topicDic"/>.
        /// Returns true if adding was successful, false if there are already 99 of this topic, or if 'amount' is negative and there are 0 of this topic.
        /// </summary>
        /// <param name="topicID">ID of the topic, as seen in ActionScene.instance.topicDic</param>
        /// <param name="showPopup">Should the "topic gained" popup be shown to the player (might not work outside of the roaming map and talk scenes, make sure to test)</param>
        /// <param name="amount">How much of the topic to add. Set to negative number to subtract. Range is -99 to 99 (player can only hold 99 of a single topic).</param>
        public static bool AddTopicToInventory(int topicID, bool showPopup = true, int amount = 1)
        {
            if (StudioAPI.InsideStudio)
            {
                return(false);
            }

            if (amount < -99 || amount > 99)
            {
                throw new ArgumentOutOfRangeException(nameof(amount), amount, "Value must be between -99 and 99");
            }
            if (!ActionScene.initialized)
            {
                throw new InvalidOperationException("ActionScene is not initialized");
            }

            if (ActionScene.instance.topicDic.TryGetValue(topicID, out var param))
            {
                if (showPopup && !InformationUI.initialized)
                {
                    showPopup = false;
                }

                var topicStock = Game.Player.topicStock;

                if (!topicStock.TryGetValue(topicID, out var topicState))
                {
                    topicState = topicStock[topicID] = new SaveData.Player.TopicState();
                }

                if (topicState.Add(amount))
                {
                    if (showPopup)
                    {
                        InformationUI.SetTopic(param.Name);
                    }
                    return(true);
                }
                else
                {
                    if (showPopup)
                    {
                        InformationUI.SetTopicFull();
                    }
                    return(false);
                }
            }
            //todo handle missing topics differently?
            KoikatuAPI.Logger.LogWarning("Tried to add nonexisting topic ID=" + topicID);
            return(false);
        }
Exemplo n.º 3
0
    public static InformationUI Getinstance()
    {
        if (instance == null)
        {
            instance = FindObjectOfType <InformationUI>();

            if (instance == null)
            {
                Debug.LogError("There Needs to one Active InformationUI Script a GameObject in your Scene");
            }

            return(instance);
        }

        return(instance);
    }
Exemplo n.º 4
0
    private void StartTimer()
    {
        if (Timer >= CutTime)
        {
            Timer = 0f;
            this.gameObject.SetActive(false);

            DropItem();
            InformationUI.Getinstance().Info_Window.SetActive(false);
        }

        Timer += Time.deltaTime;

        InformationUI.Getinstance().CastingBar.SetActive(true);
        InformationUI.Getinstance().images[1].rectTransform.localScale = new Vector3((Timer / CutTime), 1f, 1f);
    }
Exemplo n.º 5
0
        public void ExitButton()
        {
            ARBuilder.Instance.CameraDeviceBehaviours[0].SetFlashTorchMode(false);
            TorchIcon.SetActive(false);

            MenuUI.SetActive(true);
            ReviewUI.SetActive(false);
            InformationUI.SetActive(false);

            MenuAnimator.Play("RightMenu");

            Time.timeScale            = TimeDefaultBackup;
            InformationButton.Touched = true;

            ImageCreater.ClearTexture();
            ImageManager.ClearAllTarget();
        }
Exemplo n.º 6
0
 private void Update()
 {
     //if(isClick)
     //{
     //	StartTimer();
     //}
     if (GetPlayerDistance() <= Distance)
     {
         if (Input.GetKeyDown(KeyCode.F) || isClick)
         {
             Debug.Log("Input Key F");
             CutDownTree();
             StartTimer();
         }
         else
         {
             InformationUI.Getinstance().Info_Window.SetActive(true);
             InformationUI.Getinstance().CastingBar.SetActive(false);
             InformationUI.Getinstance().Info_Text.text = "F키를 눌러 나무 베기";
             isClick = false;
         }
     }
 }