/// <summary> /// 开始制作 /// </summary> public void StartMake() { //如果满足制作条件 if (PlentyOfGoods() && Ctrl_MakeQueueManager.Instance.MakeSlots.Count <= 7) { //TUDO 铁匠台减去制作需求的物品 Ctrl_MakeSlot makeSlot = new Ctrl_MakeSlot { Item = Item, MakeCount = multiple }; for (int i = 0; i < multiple; i++) { Ctrl_BlacksmithStation.Instance.RemoveItem(makeSlot.Item.drawing); } //如果正在制作的格子不为空 if (Ctrl_MakeQueueManager.Instance.GetInProduction() != null) { Ctrl_MakeQueueManager.Instance.AddMakeSlot(makeSlot); } //新建一个制作格子,并且开始制作 else { Ctrl_MakeQueueManager.Instance.StartMake(makeSlot); } } }
/// <summary> /// 创建新的制作格子 /// </summary> /// <param name="makeSlot"></param> public Ctrl_MakeSlot CreateNewMakeSlot(Ctrl_MakeSlot makeSlot) { GameObject goMakeSlot = Resources.Load <GameObject>("Prefabs/UI/Make/Make Slot"); goMakeSlot = Instantiate(goMakeSlot); goMakeSlot.transform.parent = transform; goMakeSlot.transform.localScale = Vector3.one; Ctrl_MakeSlot NewMakeSlot = goMakeSlot.GetComponent <Ctrl_MakeSlot>(); NewMakeSlot.gameObject.SetActive(true); NewMakeSlot.Item = makeSlot.Item; NewMakeSlot.MakeCount = makeSlot.MakeCount; NewMakeSlot.InitMake(); return(NewMakeSlot); }
/// <summary> /// 初始化并开始制作(后续有修改) /// </summary> /// <param name="item"></param> /// <param name="count"></param> public void StartMake(Ctrl_MakeSlot makeSlot) { CreateNewMakeSlot(makeSlot).StartMake(); }
/// <summary> /// 增加队列制作物品 /// </summary> /// <param name="makeSlot"></param> public void AddMakeSlot(Ctrl_MakeSlot makeSlot) { makeCache.Add(CreateNewMakeSlot(makeSlot)); }