Beispiel #1
0
 public void OnChangeFormation(
     EzMoldModel moldModel,
     int index,
     EzForm form
     )
 {
     _rows[index].Initialize(
         _inventoryWatcher,
         _formationWatcher,
         index,
         false,
         onChoiceParty,
         new ChoiceSlotEvent()
         );
 }
Beispiel #2
0
        void OnChangeFormation(
            EzMoldModel moldModel,
            int moldIndex,
            EzForm form
            )
        {
            if (_form.Index != form.Index)
            {
                return;
            }

            OnChangeInventory(
                _unitWatcher.Inventory,
                _unitWatcher.ItemSets
                );
        }
Beispiel #3
0
        private void GetFormAction(
            EzMoldModel moldModelTemp,
            int index,
            EzForm form
            )
        {
            if (moldModelTemp.Name != _moldModel.Name)
            {
                return;
            }

            while (_forms.Count <= index)
            {
                _forms.Add(null);
            }
            _forms[index] = form;

            onWatchFormation.Invoke(_moldModel, index, form);
        }
Beispiel #4
0
        public void Initialize(
            InventoryWatcher unitWatcher,
            FormationWatcher partyWatcher,
            int moldIndex,
            EzForm form
            )
        {
            _unitWatcher  = unitWatcher;
            _partyWatcher = partyWatcher;
            _unitWatcher.onWatchInventoryEvent.AddListener(OnChangeInventory);
            _partyWatcher.onWatchFormation.AddListener(OnChangeFormation);

            _form = form;

            OnChangeFormation(
                _partyWatcher.MoldModel,
                moldIndex,
                form
                );
        }
 public EzGetFormResult(
     GetFormResult result
     )
 {
     if (result.item != null)
     {
         Item = new EzForm(result.item);
     }
     if (result.mold != null)
     {
         Mold = new EzMold(result.mold);
     }
     if (result.moldModel != null)
     {
         MoldModel = new EzMoldModel(result.moldModel);
     }
     if (result.formModel != null)
     {
         FormModel = new EzFormModel(result.formModel);
     }
 }
Beispiel #6
0
 public EzSetFormResult(
     SetFormWithSignatureResult result
     )
 {
     if (result.item != null)
     {
         Item = new EzForm(result.item);
     }
     if (result.mold != null)
     {
         Mold = new EzMold(result.mold);
     }
     if (result.moldModel != null)
     {
         MoldModel = new EzMoldModel(result.moldModel);
     }
     if (result.formModel != null)
     {
         FormModel = new EzFormModel(result.formModel);
     }
 }
Beispiel #7
0
 public EzGetFormWithSignatureResult(
     GetFormWithSignatureResult result
     )
 {
     if (result.item != null)
     {
         Item = new EzForm(result.item);
     }
     Body      = result.body;
     Signature = result.signature;
     if (result.mold != null)
     {
         Mold = new EzMold(result.mold);
     }
     if (result.moldModel != null)
     {
         MoldModel = new EzMoldModel(result.moldModel);
     }
     if (result.formModel != null)
     {
         FormModel = new EzFormModel(result.formModel);
     }
 }
Beispiel #8
0
        public void OnChangeFormation(
            EzMoldModel moldModel,
            int moldIndex,
            EzForm form
            )
        {
            if (_index != moldIndex)
            {
                return;
            }

            var unitGameObjects = new List <MonoBehaviour>();

            void ClearChoicePanel()
            {
                foreach (var unitGameObject in unitGameObjects)
                {
                    for (var i = 0; i < unitGameObject.transform.childCount; i++)
                    {
                        var childGameObject = unitGameObject.transform.GetChild(i);
                        if (childGameObject.name.StartsWith("Choice"))
                        {
                            Destroy(childGameObject.gameObject);
                        }
                    }
                }
            }

            for (var i = 0; i < horizontalLayoutGroup.transform.childCount; i++)
            {
                Destroy(horizontalLayoutGroup.transform.GetChild(i).gameObject);
            }

            for (var i = 0; i < moldModel.FormModel.Slots.Count; i++)
            {
                var slot = form?.Slots?.FirstOrDefault(v => v?.Name == i.ToString());

                MonoBehaviour item;
                if (slot?.PropertyId == null)
                {
                    item = Instantiate(unitItemEmptyPrefab, horizontalLayoutGroup.transform);
                }
                else
                {
                    var unitItem = Instantiate(unitItemPrefab, horizontalLayoutGroup.transform);
                    unitItem.Initialize(
                        _inventoryWatcher.ItemModels.FirstOrDefault(itemModel =>
                                                                    itemModel.Name == ItemSet.GetItemNameFromGrn(slot.PropertyId)),
                        _inventoryWatcher.ItemSets.FirstOrDefault(itemSet => itemSet.ItemSetId == slot.PropertyId)
                        );
                    item = unitItem;
                }

                var i1 = i;
                item.GetComponent <Button>().onClick.AddListener(() =>
                {
                    ClearChoicePanel();
                    Instantiate(choiceUnitPrefab, item.transform);
                    _onChoiceSlot.Invoke(form, i1, slot);
                });
                item.gameObject.SetActive(true);
                item.GetComponent <Image>().raycastTarget = _enableSelectUnit;
                item.GetComponent <Button>().enabled      = _enableSelectUnit;
                unitGameObjects.Add(item);
            }
        }
Beispiel #9
0
        public void OnChoiceParty(
            EzMoldModel moldModel,
            int index,
            EzForm form
            )
        {
            Debug.Log("PartyDirector::OnChoiceParty");

            _selectedMoldModel = moldModel;
            _selectedMoldIndex = index;
            if (form == null)
            {
                var slots = new List <EzSlot>();
                foreach (var slot in _selectedMoldModel.FormModel.Slots)
                {
                    slots.Add(
                        new EzSlot
                    {
                        Name = slot.Name,
                    }
                        );
                }
                _selectedForm = new EzForm
                {
                    Index = index,
                    Slots = slots,
                };
            }
            else
            {
                _selectedForm = form;
            }

            void OnChoiceSlot(
                EzForm _,
                int slotIndex,
                EzSlot __
                )
            {
                Debug.Log("PartyDirector::OnChoiceSlot");

                _selectedSlotIndex = slotIndex;
            }

            var onChoiceSlot = new ChoiceSlotEvent();

            onChoiceSlot.AddListener(OnChoiceSlot);
            partyInformationWidget.Initialize(
                _unitInventoryWatcher,
                _formationWatcher,
                index,
                onChoiceSlot
                );

            partyUnitListWidget.Initialize(
                _unitInventoryWatcher,
                _formationWatcher,
                _selectedMoldIndex,
                _selectedForm
                );

            partyListWidget.gameObject.SetActive(false);
            partyUnitListWidget.gameObject.SetActive(true);
        }