Exemple #1
0
 public void UpRecipeTree()
 {
     if (this.RecipeTree == null || this.RecipeTree.Parent == null)
     {
         return;
     }
     this.RecipeTree = this.RecipeTree.Parent;
 }
Exemple #2
0
 public void SetRecipeTree(RecipeTree _recipe_tree, bool is_common)
 {
     if (this.RecipeTree != null)
     {
         this.RecipeTree.SetChild(_recipe_tree);
     }
     if (is_common)
     {
         _recipe_tree.SetIsCommon();
     }
     this.RecipeTree = _recipe_tree;
 }
Exemple #3
0
        private void RefreshRecipeItems()
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.RecipeParent, (UnityEngine.Object)null) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.SelectedItem, (UnityEngine.Object)null))
            {
                return;
            }
            ((Component)this.RecipeParent).get_gameObject().SetActive(false);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.CreateButton, (UnityEngine.Object)null))
            {
                ((Component)this.CreateButton).get_gameObject().SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.CreateButtonAll, (UnityEngine.Object)null))
            {
                ((Component)this.CreateButtonAll).get_gameObject().SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ConfirmRecipeButton, (UnityEngine.Object)null))
            {
                ((Component)this.ConfirmRecipeButton).get_gameObject().SetActive(false);
            }
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.RecipeListItemTemplate, (UnityEngine.Object)null) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.RecipeListParent, (UnityEngine.Object)null) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.RecipeListLine, (UnityEngine.Object)null))
            {
                return;
            }
            for (int index = 0; index < this.RecipeItems.Count; ++index)
            {
                ((Component)this.RecipeItems[index]).get_gameObject().SetActive(false);
            }
            int index1 = this.mItemParamTree.Count - 1;

            DataSource.Bind <ItemParam>(((Component)this.SelectedItem).get_gameObject(), this.mItemParamTree[index1]);
            RecipeParam recipeParam = MonoSingleton <GameManager> .Instance.GetRecipeParam(this.mItemParamTree[index1].recipe);

            if (recipeParam == null)
            {
                return;
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ConfirmRecipeButton, (UnityEngine.Object)null))
            {
                ((Component)this.ConfirmRecipeButton).get_gameObject().SetActive(true);
            }
            ((Component)this.RecipeParent).get_gameObject().SetActive(true);
            this.ActiveCommonEquipButton(this.IsCommonEquipUI((long)GlobalVars.SelectedUnitUniqueID, (int)GlobalVars.SelectedEquipmentSlot));
            for (int index2 = 0; index2 < recipeParam.items.Length; ++index2)
            {
                if (index2 >= this.RecipeItems.Count)
                {
                    ((Component)this.RecipeListItemTemplate).get_gameObject().SetActive(index2 > 0);
                    ((Component)this.RecipeListLine).get_gameObject().SetActive(index2 > 0);
                    ListItemEvents listItemEvents = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)this.RecipeListItemTemplate);
                    ((Component)listItemEvents).get_transform().SetParent((Transform)this.RecipeListParent, false);
                    this.RecipeItems.Add((EquipRecipeItem)((Component)listItemEvents).get_gameObject().GetComponent <EquipRecipeItem>());
                    ((Component)this.RecipeListLine).get_gameObject().SetActive(false);
                    ((Component)this.RecipeListItemTemplate).get_gameObject().SetActive(false);
                }
                ListItemEvents component = (ListItemEvents)((Component)this.RecipeItems[index2]).GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                {
                    component.OnSelect = new ListItemEvents.ListItemEvent(this.OnRecipeItemSelect);
                }
                ((Component)this.RecipeItems[index2]).get_gameObject().SetActive(true);
                RecipeItem          recipeItem = recipeParam.items[index2];
                RecipeItemParameter data       = new RecipeItemParameter();
                data.Item = MonoSingleton <GameManager> .Instance.GetItemParam(recipeItem.iname);

                data.RecipeItem = recipeItem;
                data.Amount     = MonoSingleton <GameManager> .Instance.Player.GetItemAmount(data.Item.iname);

                data.RequiredAmount = recipeItem.num;
                DataSource.Bind <RecipeItemParameter>(((Component)this.RecipeItems[index2]).get_gameObject(), data);
            }
            int cost = 0;
            Dictionary <string, int> consumes = (Dictionary <string, int>)null;
            bool is_ikkatsu = false;

            this.mNeedEquipItemList = new NeedEquipItemList();
            bool flag1 = MonoSingleton <GameManager> .GetInstanceDirect().Player.CheckEnableCreateItem(this.mItemParamTree[index1], ref is_ikkatsu, ref cost, ref consumes, this.mNeedEquipItemList);

            List <RecipeTree> recipeTreeChildren = this.mNeedEquipItemList.GetCurrentRecipeTreeChildren();
            bool            flag2      = recipeTreeChildren != null && recipeTreeChildren.Count > 0;
            EquipRecipeItem component1 = (EquipRecipeItem)((Component)this.SelectedItem).GetComponent <EquipRecipeItem>();

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
            {
                component1.SetIsCommonLine(this.mNeedEquipItemList.IsEnoughCommon());
            }
            for (int index2 = 0; index2 < this.RecipeItems.Count; ++index2)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                UnitEquipmentWindow.\u003CRefreshRecipeItems\u003Ec__AnonStorey391 itemsCAnonStorey391 = new UnitEquipmentWindow.\u003CRefreshRecipeItems\u003Ec__AnonStorey391();
                this.RecipeItems[index2].SetIsCommonLine(flag2 && !flag1 && this.mNeedEquipItemList.IsEnoughCommon());
                // ISSUE: reference to a compiler-generated field
                itemsCAnonStorey391.recipe = DataSource.FindDataOfClass <RecipeItemParameter>(((Component)this.RecipeItems[index2]).get_gameObject(), (RecipeItemParameter)null);
                // ISSUE: reference to a compiler-generated method
                RecipeTree recipeTree = !flag2 ? (RecipeTree)null : recipeTreeChildren.Find(new Predicate <RecipeTree>(itemsCAnonStorey391.\u003C\u003Em__452));
                bool       flag3      = this.mNeedEquipItemList.IsEnoughCommon();
                this.RecipeItems[index2].SetIsCommon(recipeTree != null && (recipeTree.IsCommon && flag3));
            }
            if (!flag1 && !this.mNeedEquipItemList.IsEnoughCommon())
            {
                return;
            }
            if (is_ikkatsu)
            {
                if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.CreateButtonAll, (UnityEngine.Object)null))
                {
                    return;
                }
                ((Component)this.CreateButtonAll).get_gameObject().SetActive(true);
            }
            else
            {
                if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.CreateButton, (UnityEngine.Object)null))
                {
                    return;
                }
                ((Component)this.CreateButton).get_gameObject().SetActive(true);
            }
        }
Exemple #4
0
 public void SetChild(RecipeTree child)
 {
     child.parent = this;
     this.children.Add(child);
 }