private void StartConstruct()
 {
     if (!CurrentPreview)
     {
         return;
     }
     if (CurrentPreview.StartConstruct())
     {
         ProgressBar.Instance.New(CurrentPreview.Data.currentStage.BuildTime, delegate
         {
             return(CurrentPreview.Data.currentStage.BuildTime - CurrentPreview.Data.leftBuildTime);
         },
                                  delegate
         {
             return(CurrentPreview == null || CurrentPreview.Data == null || !CurrentPreview.Data.IsBuilding);
         },
                                  delegate
         {
             if (CurrentPreview)
             {
                 CurrentPreview.PauseConstruct();
             }
         }, "施工中");
     }
     ZetanUtility.SetActive(morePanel, false);
 }
示例#2
0
 public virtual void OpenWindow()
 {
     if (!UI || !UI.gameObject)
     {
         return;
     }
     if (IsUIOpen)
     {
         return;
     }
     if (IsPausing)
     {
         return;
     }
     if (!animated)
     {
         UI.window.alpha = 1;
     }
     else
     {
         ZetanUtility.FadeTo(1, animationSpeed, this);
     }
     UI.window.blocksRaycasts = true;
     WindowsManager.Instance.Push(this);
     IsUIOpen = true;
 }
示例#3
0
 public override void OnDrawGizmosSelected()
 {
     if (transform)
     {
         ZetanUtility.DrawGizmosCircle(transform.position, distance);
     }
 }
示例#4
0
 IEnumerator FixTextWidth()
 {
     while (true)
     {
         if (IsOpen)
         {
             if (tipsContent.rectTransform.rect.width < 380 && tipsFitter.horizontalFit != ContentSizeFitter.FitMode.PreferredSize)
             {
                 tipsFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
             }
             else if (tipsContent.rectTransform.rect.width > 380 && tipsFitter.horizontalFit != ContentSizeFitter.FitMode.Unconstrained)
             {
                 tipsFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
             }
             if (tipBackground.rect.width > 400)
             {
                 tipBackground.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 400);
             }
             ZetanUtility.KeepInsideScreen(tipBackground);
             yield return(wait);
         }
         else
         {
             yield return(new WaitUntil(() => IsOpen));
         }
     }
 }
示例#5
0
    public MapIcon CreateMapIcon(Sprite iconSprite, Vector2 size, Vector3 worldPosition, bool keepOnMap, float rangeSize,
                                 MapIconType iconType, bool removeAble, string textToDisplay = "")
    {
        if (!UI || !UI.gameObject || !iconSprite)
        {
            return(null);
        }
        MapIcon icon = ObjectPool.Get(UI.iconPrefab.gameObject, SelectParent(iconType)).GetComponent <MapIcon>();

        InitIcon();
        IconsWithoutHolder.Add(icon, new MapIconWithoutHolder(worldPosition, icon, keepOnMap, removeAble, textToDisplay));
        return(icon);

        void InitIcon()
        {
            icon.iconImage.rectTransform.pivot     = new Vector2(0.5f, 0.5f);
            icon.iconImage.overrideSprite          = iconSprite;
            icon.iconImage.rectTransform.sizeDelta = size;
            icon.iconType = iconType;
            if (rangeSize > 0)
            {
                icon.iconRange = ObjectPool.Get(UI.rangePrefab.gameObject, UI.rangesParent).GetComponent <MapIconRange>();
                ZetanUtility.SetActive(icon.iconRange.gameObject, true);
                icon.iconRange.rectTransform.sizeDelta = new Vector2(rangeSize, rangeSize);
            }
            icon.RemoveAble    = removeAble;
            icon.TextToDisplay = textToDisplay;
        }
    }
示例#6
0
 public void Defocus()
 {
     Quest              = null;
     titleText.text     = string.Empty;
     objectiveText.text = string.Empty;
     ZetanUtility.SetActive(gameObject, false);
 }
示例#7
0
 public override string ToString()
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     foreach (var material in materials)
     {
         if (material && material.IsValid)
         {
             if (material.MakingType == MakingType.SingleItem)
             {
                 sb.Append("[");
                 sb.Append(material.ItemName);
                 sb.Append("] × ");
                 sb.Append(material.Amount);
             }
             else
             {
                 sb.Append("<");
                 sb.Append(ZetanUtility.GetInspectorName(material.MaterialType));
                 sb.Append("> × ");
                 sb.Append(material.Amount);
             }
             if (materials.IndexOf(material) != materials.Count - 1)
             {
                 sb.Append("\n");
             }
         }
     }
     return(sb.ToString());
 }
示例#8
0
 public void ResetIcon()
 {
     Current   = null;
     onEndDrag = null;
     raycastResults.Clear();
     ZetanUtility.SetActive(icon.gameObject, false);
 }
示例#9
0
        public override void OnInspectorGUI()
        {
            if (FindObjectsOfType <BehaviourManager>().Length > 1)
            {
                EditorGUILayout.HelpBox("存在多个激活的BehaviourManager,请删除或失活其它", MessageType.Error);
                return;
            }
            serializedObject.UpdateIfRequiredOrScript();
            EditorGUI.BeginChangeCheck();
            bool shouldDisable = Application.isPlaying && !PrefabUtility.IsPartOfAnyPrefab(target);

            EditorGUI.BeginDisabledGroup(shouldDisable);
            var globalBef = globalVariables.objectReferenceValue;

            if (shouldDisable)
            {
                EditorGUILayout.PropertyField(globalVariables, new GUIContent("全局变量"));
            }
            else
            {
                globalDrawer.DoLayoutDraw();
            }
            if (!globalVariables.objectReferenceValue && ZetanUtility.Editor.LoadAsset <GlobalVariables>() == null)
            {
                if (GUILayout.Button("新建"))
                {
                    globalVariables.objectReferenceValue = ZetanUtility.Editor.SaveFilePanel(CreateInstance <GlobalVariables>, "global variables");
                }
            }
            EditorGUI.EndDisabledGroup();
            if (globalVariables.objectReferenceValue != globalBef)
            {
                InitGlobal();
            }
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
            if (globalVariables.objectReferenceValue)
            {
                serializedObject.UpdateIfRequiredOrScript();

                showGlobal.target = EditorGUILayout.Foldout(serializedVariables.isExpanded, "全局变量列表", true);;
                if (EditorGUILayout.BeginFadeGroup(showGlobal.faded))
                {
                    variableList.DoLayoutList();
                }
                EditorGUILayout.EndFadeGroup();
                if (!Application.isPlaying && !ZetanUtility.IsPrefab((target as BehaviourManager).gameObject))
                {
                    showPreset.target = EditorGUILayout.Foldout(presetVariables.isExpanded, "变量预设列表", true);
                    if (EditorGUILayout.BeginFadeGroup(showPreset.faded))
                    {
                        presetVariableList.DoLayoutList();
                    }
                    EditorGUILayout.EndFadeGroup();
                }
                serializedObject.ApplyModifiedProperties();
            }
        }
示例#10
0
 public void Death()
 {
     //Debug.Log("One [" + info.Name + "] was killed");
     OnDeathEvent?.Invoke();
     QuestManager.Instance.UpdateUI();
     if (info.DropItems.Count > 0)
     {
         List <ItemInfo> lootItems = new List <ItemInfo>();
         foreach (DropItemInfo di in info.DropItems)
         {
             if (ZetanUtility.Probability(di.DropRate))
             {
                 if (!di.OnlyDropForQuest || (di.OnlyDropForQuest && QuestManager.Instance.HasOngoingQuestWithID(di.BindedQuest.ID)))
                 {
                     lootItems.Add(new ItemInfo(di.Item, Random.Range(1, di.Amount + 1)));
                 }
             }
         }
         if (lootItems.Count > 0)
         {
             LootAgent la = ObjectPool.Get(info.LootPrefab).GetComponent <LootAgent>();
             la.Init(lootItems, transform.position);
         }
     }
 }
示例#11
0
    private void Awake()
    {
#if UNITY_STANDALONE
        EnableJoyStick(false);
        ZetanUtility.SetActive(JoyStick.gameObject, false);
        ZetanUtility.SetActive(JoyStick.KnobBackground.gameObject, false);
#elif UNITY_ANDROID
        ZetanUtility.SetActive(JoyStick.gameObject, true);
#endif
        ZetanUtility.SetActive(InteractionButton.gameObject, false);
        questButton.onClick.AddListener(QuestManager.Instance.OpenCloseWindow);
        backpackButton.onClick.AddListener(BackpackManager.Instance.OpenCloseWindow);
        calendarButton.onClick.AddListener(CalendarManager.Instance.OpenCloseWindow);
        buildingButton.onClick.AddListener(BuildingManager.Instance.OpenCloseWindow);
        settingButton.onClick.AddListener(EscapeMenuManager.Instance.OpenCloseWindow);
        if (!dontDestroyOnLoadOnce)
        {
            DontDestroyOnLoad(this);
            dontDestroyOnLoadOnce = true;
        }
        else
        {
            DestroyImmediate(gameObject);
        }
    }
示例#12
0
    public static List <ItemWithAmount> Drop(IEnumerable <DropItemInfo> DropItems)
    {
        List <ItemWithAmount> lootItems         = new List <ItemWithAmount>();
        Dictionary <string, ItemWithAmount> map = new Dictionary <string, ItemWithAmount>();

        foreach (DropItemInfo di in DropItems)
        {
            if (ZetanUtility.Probability(di.DropRate))
            {
                if (!di.OnlyDropForQuest || QuestManager.Instance.HasOngoingQuest(di.BindedQuest.ID))
                {
                    if (di.item.StackAble)
                    {
                        if (map.TryGetValue(di.ItemID, out var find))
                        {
                            find.amount += Random.Range(di.MinAmount, di.MaxAmount + 1);
                        }
                        else
                        {
                            var iaw = new ItemWithAmount(di.item.CreateData(), Random.Range(di.MinAmount, di.MaxAmount + 1));
                            map.Add(di.ItemID, iaw);
                            lootItems.Add(iaw);
                        }
                    }
                    else
                    {
                        lootItems.Add(new ItemWithAmount(di.item.CreateData(), Random.Range(di.MinAmount, di.MaxAmount + 1)));
                    }
                }
            }
        }
        return(lootItems);
    }
示例#13
0
 IEnumerator FixTextWidth()
 {
     while (true)
     {
         if (UI && UI.gameObject && UI.tipBackground.gameObject.activeSelf)
         {
             if (UI.tipsContent.rectTransform.rect.width < 380 && UI.tipsFitter.horizontalFit != UnityEngine.UI.ContentSizeFitter.FitMode.PreferredSize)
             {
                 UI.tipsFitter.horizontalFit = UnityEngine.UI.ContentSizeFitter.FitMode.PreferredSize;
             }
             else if (UI.tipsContent.rectTransform.rect.width > 380 && UI.tipsFitter.horizontalFit != UnityEngine.UI.ContentSizeFitter.FitMode.Unconstrained)
             {
                 UI.tipsFitter.horizontalFit = UnityEngine.UI.ContentSizeFitter.FitMode.Unconstrained;
             }
             if (UI.tipBackground.rect.width > 400)
             {
                 UI.tipBackground.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 400);
             }
             ZetanUtility.KeepInsideScreen(UI.tipBackground);
             yield return(waitForSeconds);
         }
         else
         {
             yield return(new WaitUntil(() => { return UI && UI.gameObject && UI.tipBackground.gameObject.activeSelf; }));
         }
     }
 }
示例#14
0
 public void New(Action confirmAction, Action cancelAction, long max, string title = "")
 {
     if (max < min)
     {
         max = max + min;
         min = max - min;
         max = max - min;
     }
     this.max       = max;
     min            = 0;
     Amount         = max >= 0 ? 0 : min;
     UI.amount.text = Amount.ToString();
     onConfirm      = confirmAction;
     onCancel       = cancelAction;
     UI.windowCanvas.sortingOrder = WindowsManager.Instance.TopOrder + 1;
     UI.window.alpha          = 1;
     UI.window.blocksRaycasts = true;
     if (string.IsNullOrEmpty(title))
     {
         UI.title.text = "输入数量";
     }
     else
     {
         UI.title.text = title;
     }
     ZetanUtility.KeepInsideScreen(UI.windowRect);
 }
示例#15
0
    public void RefreshDescription()
    {
        title.text           = selectedQuest.Model.Title;
        giver.text           = $"[委托人:{selectedQuest.originalQuestHolder.TalkerName}]";
        descriptionText.text = selectedQuest.Model.Description;
        StringBuilder objectives        = new StringBuilder();
        var           displayObjectives = selectedQuest.Objectives.Where(x => x.Model.Display).ToArray();
        int           lineCount         = displayObjectives.Length - 1;

        for (int i = 0; i < displayObjectives.Length; i++)
        {
            string endLine = i == lineCount ? string.Empty : "\n";
            if (selectedQuest.IsFinished)
            {
                objectives.AppendFormat("-{0}{1}", displayObjectives[i].Model.DisplayName, endLine);
            }
            else
            {
                objectives.AppendFormat("-{0}{1}{2}", displayObjectives[i], displayObjectives[i].IsComplete ? "\t(达成)" : string.Empty, endLine);
            }
        }
        objectiveText.text = objectives.ToString();
        rewardList.Refresh(ItemSlotData.Convert(selectedQuest.Model.RewardItems, maxRewardCount));

        ZetanUtility.SetActive(abandonButton.gameObject, !selectedQuest.IsFinished && selectedQuest.Model.Abandonable);
        ZetanUtility.SetActive(traceButton.gameObject, !selectedQuest.IsFinished);
        RefreshTraceText();
    }
示例#16
0
 public void ShowAndMovePreview()
 {
     if (!preview)
     {
         return;
     }
     preview.transform.position = ZetanUtility.PositionToGrid(GetMovePosition(), gridSize, preview.CenterOffset);
     if (preview.ColliderCount > 0)
     {
         if (preview.SpriteRenderer)
         {
             preview.SpriteRenderer.color = Color.red;
         }
     }
     else
     {
         if (preview.SpriteRenderer)
         {
             preview.SpriteRenderer.color = Color.white;
         }
     }
     if (ZetanUtility.IsMouseInsideScreen)
     {
         if (Input.GetMouseButtonDown(0))
         {
             Build();
         }
         if (Input.GetMouseButtonDown(1))
         {
             FinishPreview();
         }
     }
 }
示例#17
0
    private void Awake()
    {
        if (preview.layer != LayerMask.NameToLayer("StructurePreview"))
        {
            preview.layer = LayerMask.NameToLayer("StructurePreview");
        }

        ZetanUtility.SetActive(preview, true);
        ZetanUtility.SetActive(structure, false);

        renderers = GetComponentsInChildren <MeshRenderer>();
        renderers = renderers.Concat(GetComponentsInChildren <SpriteRenderer>()).ToArray();

        foreach (Renderer renderer in renderers)
        {
            if (renderer.gameObject.activeSelf)
            {
                oriColors.Add(renderer, renderer.material.color);
                redColors.Add(renderer, renderer.material.color * Color.red);
            }
        }

        Collider2D[] collider2Ds = preview.GetComponentsInChildren <Collider2D>();
        foreach (Collider2D collider2D in collider2Ds)
        {
            collider2D.isTrigger = true;
        }
    }
示例#18
0
 public void New(float seconds, Func <float> getTime, Func <bool> cancelCondition, Action cancelAction, string actionName = null)
 {
     targetTime   = seconds;
     this.getTime = getTime;
     if (progressCoroutine != null)
     {
         StopCoroutine(progressCoroutine);
         progressCoroutine = null;
     }
     isProgressing = true;
     if (actionText)
     {
         if (string.IsNullOrEmpty(actionName))
         {
             ZetanUtility.SetActive(actionText.gameObject, false);
         }
         else
         {
             actionText.text = actionName;
             ZetanUtility.SetActive(actionText.gameObject, true);
         }
     }
     if (cancelCondition != null)
     {
         shouldCancel = cancelCondition;
     }
     else
     {
         shouldCancel = () => { return(true); }
     };
     onCancel = cancelAction;
     ZetanUtility.SetActive(bar, true);
     ZetanUtility.SetActive(cancel, true);
     progressCoroutine = StartCoroutine(ProgressCustom());
 }
示例#19
0
    public void Refresh()
    {
        if (!Quest || Quest.IsFinished)
        {
            Defocus();
            return;
        }
        ZetanUtility.SetActive(gameObject, true);
        titleText.text = $"{(Quest.IsComplete ? "[完成]" : string.Empty)}{Quest.Model.Title}";
        StringBuilder objectives = new StringBuilder();

        if (Quest.IsComplete)
        {
            objectiveText.text = string.Empty;
        }
        else
        {
            var displayObjectives = Quest.Objectives.Where(x => x.Model.Display).ToArray();
            int lineCount         = displayObjectives.Length - 1;
            for (int i = 0; i < displayObjectives.Length; i++)
            {
                var objective = displayObjectives[i];
                if (!objective.IsComplete && (!objective.Model.InOrder || objective.AllPrevComplete))
                {
                    string endLine = i == lineCount ? string.Empty : "\n";
                    objectives.AppendFormat("-{0}{1}", objective, endLine);
                }
            }
        }
        objectiveText.text = objectives.ToString();
    }
示例#20
0
    private float cleanDelayTime = 600.0f;//池子东西放多放久了臭,要按时排掉

    public static void Put(GameObject gameObject)
    {
        if (!gameObject)
        {
            return;
        }
        if (!Instance || Instance.pool.Count > Instance.capacity)
        {
            Destroy(gameObject);
            return;
        }
        if (Instance.putDelayCoroutines.TryGetValue(gameObject, out var c))
        {
            Instance.StopCoroutine(c);
        }
        ZetanUtility.SetActive(gameObject, false);
        gameObject.transform.SetParent(Instance.poolRoot, false);
        string name = gameObject.name.EndsWith("(Clone)") ? gameObject.name : gameObject.name + "Clone";

        Instance.pool.TryGetValue(name, out var oListFound);
        if (oListFound != null)
        {
            if (!oListFound.Contains(gameObject))
            {
                oListFound.Add(gameObject);
            }
        }
        else
        {
            Instance.pool.Add(name, new HashSet <GameObject>()
            {
                gameObject
            });
        }
    }
示例#21
0
    protected override bool OnOpen(params object[] args)
    {
        if (args.Length < 4)
        {
            return(false);
        }
        var par = (position : (Vector2)args[0], text : args[1] as string, duration : (float)args[2], closeBtn : (bool)args[3]);

        tipBackground.position = par.position;
        ZetanUtility.SetActive(tipBackground.gameObject, true);
        ZetanUtility.SetActive(tipsContent.gameObject, true);
        tipsContent.text = par.text;
        if (hideNameCoroutine != null)
        {
            StopCoroutine(hideNameCoroutine);
        }
        if (par.duration > 0)
        {
            hideNameCoroutine = StartCoroutine(HideTextDelay(par.duration));
        }
        if (par.closeBtn)
        {
            MakeButton("关闭", Hide);
        }
        return(true);
    }
示例#22
0
    public static GameObject Get(GameObject prefab, Transform parent = null, bool worldPositionStays = false)
    {
        if (!Instance)
        {
            return(Instantiate(prefab, parent, worldPositionStays));
        }
        string goName = prefab.name.EndsWith("(Clone)") ? prefab.name : prefab.name + "(Clone)";

        if (Instance.pool.TryGetValue(goName, out var oListFound) && oListFound.Count > 0)
        {
            GameObject go = oListFound.ElementAt(0);
            oListFound.Remove(go);
            if (oListFound.Count < 1)
            {
                Instance.pool.Remove(goName);
            }
            go.transform.SetParent(parent, worldPositionStays);
            ZetanUtility.SetActive(go, true);
            if (Instance.putDelayCoroutines.TryGetValue(go, out var c))
            {
                Instance.StopCoroutine(c);
                Instance.putDelayCoroutines.Remove(go);
            }
            return(go);
        }
        else
        {
            return(Instantiate(prefab, parent, worldPositionStays));
        }
    }
示例#23
0
 private void ShowAll()
 {
     foreach (var sa in SeedAgents)
     {
         ZetanUtility.SetActive(sa.gameObject, true);
     }
 }
示例#24
0
 public void OnHarvestSuccess()
 {
     onHarvestFinish?.Invoke();
     HarvestAble = false;
     if (currentStage.ProductItems.Count > 0)
     {
         List <ItemInfo> lootItems = new List <ItemInfo>();
         foreach (DropItemInfo di in currentStage.ProductItems)
         {
             if (ZetanUtility.Probability(di.DropRate))
             {
                 if (!di.OnlyDropForQuest || (di.OnlyDropForQuest && QuestManager.Instance.HasOngoingQuestWithID(di.BindedQuest.ID)))
                 {
                     lootItems.Add(new ItemInfo(di.Item, Random.Range(1, di.Amount + 1)));
                 }
             }
         }
         if (lootItems.Count > 0)
         {
             LootAgent la = ObjectPool.Get(currentStage.LootPrefab).GetComponent <LootAgent>();
             la.Init(lootItems, transform.position);
         }
     }
     HarvestDone();
 }
示例#25
0
 public void ShowIcon(float zoom)
 {
     if (forceHided)
     {
         return;
     }
     if (iconInstance)
     {
         iconInstance.Show(showRange);
         if (iconInstance.iconRange)
         {
             if (showRange)
             {
                 if (iconInstance.iconRange)
                 {
                     if (iconInstance.iconRange.Color != rangeColor)
                     {
                         iconInstance.iconRange.Color = rangeColor;
                     }
                     iconInstance.iconRange.rectTransform.sizeDelta = new Vector2(rangeSize * 2, rangeSize * 2) * zoom;
                 }
             }
             else
             {
                 ZetanUtility.SetActive(iconInstance.iconRange.gameObject, false);
             }
         }
     }
 }
示例#26
0
 protected override bool OnClose(params object[] args)
 {
     if (!IsOpen)
     {
         return(true);
     }
     foreach (var kvp in copySlots)
     {
         caches.Put(kvp.Value);
     }
     copySlots.Clear();
     selectedItems.Clear();
     SourceContainer.DarkIf(null);
     SourceContainer.MarkIf(null);
     SourceContainer = null;
     SourceHandler   = null;
     ZetanUtility.SetActive(tips, true);
     dialog        = string.Empty;
     SelectionType = ItemSelectionType.SelectNum;
     canSelect     = null;
     onConfirm     = null;
     if (!confirm)
     {
         onCancel?.Invoke();
     }
     onCancel = null;
     WindowsManager.CloseWindow <ItemWindow>();
     return(true);
 }
示例#27
0
 public virtual void CloseWindow()
 {
     if (!UI || !UI.gameObject)
     {
         return;
     }
     if (!IsUIOpen)
     {
         return;
     }
     if (IsPausing)
     {
         return;
     }
     if (!animated)
     {
         UI.window.alpha = 0;
     }
     else
     {
         ZetanUtility.FadeTo(0, animationSpeed, this);
     }
     UI.window.blocksRaycasts = false;
     WindowsManager.Instance.Remove(this);
     IsUIOpen = false;
 }
示例#28
0
    public void UpdateUI()
    {
        if (!UI || !UI.gameObject)
        {
            return;
        }
        UI.money.text = Backpack.Money.ToString() + GameManager.CoinName;
        Color color = UI.weight.color;
        float mul   = Backpack.weight.Current / Backpack.WeightOver;

        if (mul > 1 && mul <= 1.5f)
        {
            color = overColor;
        }
        else if (mul > 1.5f)
        {
            color = maxColor;
        }
        UI.weight.text = ZetanUtility.ColorText(Backpack.weight.Current.ToString("F2") + "/" + Backpack.WeightOver.ToString("F2") + "WL", color);
        color          = UI.size.color;
        if (Backpack.size.Rest < 5 && Backpack.size.Rest > 0)
        {
            color = overColor;
        }
        else if (Backpack.size.Rest < 1)
        {
            color = maxColor;
        }
        UI.size.text = ZetanUtility.ColorText(Backpack.size.ToString(), color);
        SetPage(currentPage);
        QuestManager.Instance.UpdateUI();
        BuildingManager.Instance.UpdateUI();
        MakingManager.Instance.UpdateUI();
    }
示例#29
0
    public void ShowDescription(ItemBase item)
    {
        if (!item)
        {
            return;
        }
        currentItem = item;
        List <string> info      = BackpackManager.Instance.GetMaterialsInfo(currentItem.Materials).ToList();
        StringBuilder materials = new StringBuilder("<b>持有数量:</b>" + BackpackManager.Instance.GetItemAmount(item));

        materials.Append("\n<b>制作材料:</b>");
        materials.Append(BackpackManager.Instance.IsMaterialsEnough(item.Materials) ? "<color=green>(可制作)</color>\n" : "<color=red>(耗材不足)</color>\n");
        for (int i = 0; i < info.Count; i++)
        {
            materials.Append(info[i] + (i == info.Count - 1 ? string.Empty : "\n"));
        }
        UI.description.text = materials.ToString();
        int makeAmount = BackpackManager.Instance.GetAmountCanMake(currentItem.Materials);

        UI.icon.SetItem(new ItemInfo(currentItem, makeAmount));
        UI.nameText.text                    = item.name;
        UI.makeButton.interactable          = makeAmount > 0;
        UI.descriptionWindow.alpha          = 1;
        UI.descriptionWindow.blocksRaycasts = true;
        ZetanUtility.SetActive(UI.loopToggle.gameObject, currentItem.DIYAble);
    }
示例#30
0
 public void UpdateInfo()
 {
     totalDays.text = MCrop.totalGrowthDays.ToString();
     ZetanUtility.SetActive(dryIcon.gameObject, MCrop.Dry);
     ZetanUtility.SetActive(pestIcon.gameObject, MCrop.Pest);
     ZetanUtility.SetActive(matureIcon.gameObject, MCrop.currentStage.HarvestAble);
 }