Esempio n. 1
0
    void BindCraftingAreaLogic()
    {
        remainingAreaScrollView.Init(view.CLGetGameObject("Window/CraftingArea/StackArea/Grid"),
                                     (idx, sample) => {
            var comp = sample.AddComponent <RemainingArea>();
            container.InjectGameObject(comp.gameObject);
            comp.Init(runtimeTable, idx);
        }, () => {
            return(staticTable.maxSlot);
        });
        remainingAreaScrollView.OnRefresh();
        Observable.EveryUpdate().Subscribe(_ => {
            var allDishes = runtimeData.GetList <DBCraftingItem>()
                            .Where(x => x.tableUID == runtimeTable.uid)
                            .OrderBy(x => x.insertedTime)
                            .ToList();
            var remaining = FIShareCraftFunc.GetRemainingDishList(easy.GlobalInfo.totalCraftedCompleteCnt, easy.ServerTime - runtimeTable.recipeStartedTime, allDishes);
//			Debug.Log("Remaining="+remaining.Count);
        }).AddTo(this.go);

        var makingComp = view.CLGetGameObject("Window/CraftingArea/StackArea/CreatingArea").AddComponent <CurrentMakingArea>();

        container.Inject(makingComp);
        makingComp.Init(runtimeTable);
    }
Esempio n. 2
0
        State OnCheckState()
        {
            var upgradeCnt = staticTable.maxSlot - staticTable.minSlot;
            var curSlotCnt = runtimeTable.upgradeLv + staticTable.minSlot - 1;           // -1 is for CurrentMakingArea
            var totalAvailableUpgradeCnt = upgradeCnt - runtimeTable.upgradeLv;

            if (idx == curSlotCnt)
            {
                if (totalAvailableUpgradeCnt > 0)
                {
                    return(State.Expand);
                }
                throw new System.Exception("Cannot Come here!");
            }
            else if (idx > curSlotCnt)
            {
                return(State.CannotExpand);
            }


            var allDishes = runtimeData.GetList <DBCraftingItem>()
                            .Where(x => x.tableUID == runtimeTable.uid)
                            .OrderBy(x => x.insertedTime)
                            .ToList();

            remainingList = FIShareCraftFunc.GetRemainingDishList(
                easy.GlobalInfo.totalCraftedCompleteCnt,
                easy.ServerTime - runtimeTable.recipeStartedTime,
                allDishes
                );
//			Debug.Log("Idx="+idx.ToString()+" Remain="+remainingList.Count);
            if (idx < remainingList.Count)
            {
                //This is making..
                currentItem = remainingList[idx];
                return(State.Waiting);
            }
            currentItem = null;

            return(State.Empty);
        }