Esempio n. 1
0
        private void InitializeTabs(Dictionary <int, string> tabs)
        {
            //前回のタブを削除
            foreach (GameObject g in _ItemTabs.Values)
            {
                DestroyObject(g);
            }
            _ItemTabs.Clear();

            int i = 0;

            foreach (int k in tabs.Keys)
            {
                //コピーを作成

                GameObject obj = CommonFunction.GetObject(TabsStack, _ItemTabUnit, _ItemTabParent.transform);
                obj.transform.localPosition = new Vector3(TabDefaultX + i * TabDefaultUnit,
                                                          TabDefaultY,
                                                          CommonConst.SystemValue.UiVectorZ);
                //obj.SetActive(true);

                //イベントハンドラの設定
                CommonFunction.AddListenerMenu(obj, EventTriggerType.PointerDown, e => OnClickTab(e, k));

                obj.GetComponentInChildren <Text>().text = tabs[k];


                _ItemTabs.Add(k, obj);
                //obj.SetActive(true);
                SetTabUnSelect(k);

                i++;
            }
        }
Esempio n. 2
0
        private void InitializeItemSubMenu()
        {
            //前回の表示項目を削除
            foreach (GameObject g in _ListViewItemSubUnits.Values)
            {
                UnityEngine.Object.Destroy(g);
            }
            _ListViewItemSubUnits.Clear();

            _MenuItemAction.SetActive(true);
            _MenuItemAction.transform.localPosition = new Vector3(SubMenuDefaultX, SubMenuDefaultY, CommonConst.SystemValue.UiVectorZ);
            //選択されたアイテムを取得
            BaseItem item = _LastTarget[nowType];

            //一番上を選択状態にする
            subSelected = 0;

            //表示対象を取得
            _subItemMenu = item.GetItemAction();

            sbyte i = 0;

            foreach (MenuItemActionType target in _subItemMenu.Values)
            {
                //コピーを作成
                GameObject obj = CommonFunction.SetItemChild(_MenuItemActionItem, _MenuItemActionPosition);

                //行動名の設定
                obj.transform.Find("Text").GetComponent <Text>().text = CommonFunction.MenuItemActionTypeName[target];
                obj.transform.localPosition = new Vector3(0, SubViewItemUnitHeight * i, 0);
                CommonFunction.SetItemUnSelectBack(obj);
                _ListViewItemSubUnits.Add(target, obj);

                //イベントハンドラの設定
                CommonFunction.AddListenerMenu(obj, EventTriggerType.PointerDown, e => OnClickSubMenu(e, target));

                obj.SetActive(true);

                i++;
            }
            subSelected = _ListViewItemSubUnits.Keys.First();


            //一件目を選択状態にする
            CommonFunction.SetItemSelectBack(_ListViewItemSubUnits[subSelected]);
        }
Esempio n. 3
0
        private void SetOptionValues(List <BaseOption> options, bool isAnalyse)
        {
            _ViesOptions = options;

            //前の情報を削除
            foreach (GameObject g in _ListViewOptionUnits.Values)
            {
                CommonFunction.DestroyObject(g, _OptionDetailView.transform);
            }
            _ListViewOptionUnits.Clear();

            _OptionDetaiDescription.GetComponent <Text>().text = "";

            //表示対象がなければ終了
            if (CommonFunction.IsNull(options) == true)
            {
                if (isAnalyse == true)
                {
                    _ItemDetail.transform.Find("DetailItemOptionCountValue").GetComponent <Text>().text =
                        "-";
                }
                else
                {
                    _ItemDetail.transform.Find("DetailItemOptionCountValue").GetComponent <Text>().text =
                        "?";
                }
                return;
            }

            if (isAnalyse == true)
            {
                _ItemDetail.transform.Find("DetailItemOptionCountValue").GetComponent <Text>().text =
                    options.Count().ToString();
            }
            else
            {
                _ItemDetail.transform.Find("DetailItemOptionCountValue").GetComponent <Text>().text =
                    "?";
                return;
            }

            int index = 0;

            foreach (BaseOption bo in options)
            {
                GameObject copy = CommonFunction.GetObject(OptionStack, _OptionDetailSelectUnit, _OptionDetailViewContent.transform);
                //GameObject copy = GameObject.Instantiate(_OptionDetailSelectUnit, _OptionDetailViewContent.transform);
                CommonFunction.SetItemUnSelectBack(copy);
                //copy.SetActive(true);
                copy.GetComponentInChildren <Text>().text = bo.DisplayNameInItem;
                copy.transform.Find("OptionSelectedOdd").gameObject.SetActive(index % 2 == 0);


                //イベントハンドラの設定
                CommonFunction.AddListenerMenu(copy, EventTriggerType.PointerDown, e => OnClickOption(e, bo));
                CommonFunction.AddListenerMenu(copy, EventTriggerType.Drag, e => OnDragOption(e), false);
                CommonFunction.AddListenerMenu(copy, EventTriggerType.Scroll, e => OnScrollOption(e), false);

                _ListViewOptionUnits.Add(bo, copy);
                index++;
            }
        }
Esempio n. 4
0
        private void InitializeItems(List <BaseItem> list)
        {
            //前回の表示項目を削除
            foreach (GameObject g in _ListViewItemUnits.Values)
            {
                //UnityEngine.Object.Destroy(g);
                CommonFunction.DestroyObject(g, _scrollItemView.transform);
            }
            _ListViewItemUnits.Clear();

            int index = 0;

            // 表示対象のアイテムの種類の数だけノードを生成
            foreach (BaseItem item in list)
            {
                index++;

                //コピーを作成
                GameObject obj = CommonFunction.GetObject(ItemsStack, _itemSelectedPrefab, _ItemContentView.transform);
                SetItemValue(obj, item, index);
                CommonFunction.SetItemUnSelectBack(obj);

                //イベントハンドラの設定
                CommonFunction.AddListenerMenu(obj, EventTriggerType.PointerDown, e => OnClickItemMenu(e, item));
                CommonFunction.AddListenerMenu(obj, EventTriggerType.Drag, e => OnDragItemMenu(e), false);
                CommonFunction.AddListenerMenu(obj, EventTriggerType.Scroll, e => OnScrollItemMenu(e), false);

                _ListViewItemUnits.Add(item, obj);
                //obj.SetActive(true);
            }

            //コンテナ内の高さを決める
            _ItemContentView.transform.GetComponent <RectTransform>().sizeDelta
                = new Vector2(0, _ListViewItemUnits.Count * ViewItemUnitHeight + 25);

            //一件以上ある場合
            if (_ListViewItemUnits.Count > 0)
            {
                //選択対象が存在しない場合は初期値を入れる
                if (CommonFunction.IsNull(_LastTarget[nowType]) == true || _ListViewItemUnits.ContainsKey(_LastTarget[nowType]) == false)
                {
                    _LastTarget[nowType] = _ListViewItemUnits.Keys.First();
                }
                float height = _ListViewItemUnits.Count * ViewItemUnitHeight;
                int   indexx = _ListViewItemUnits.Keys.ToList().IndexOf(_LastTarget[nowType]);
                int   n      = _ListViewItemUnits.Count;
                CommonFunction.SetCenterViewItem(height, _scrollItemView, indexx, n);

                //選択位置の背景を設定
                CommonFunction.SetItemSelectBack(_ListViewItemUnits[_LastTarget[nowType]]);

                //詳細の更新
                SetDetailDisplay(_LastTarget[nowType]);
            }
            //アイテムが全くない場合
            else
            {
                //名前
                _ItemDetail.transform.Find("DetailItemName").GetComponent <Text>().text = "";

                //攻撃力
                _ItemDetail.transform.Find("DetailItemAttackValue").GetComponent <Text>().text = "";

                //防御力
                _ItemDetail.transform.Find("DetailItemDefenseValue").GetComponent <Text>().text = "";

                SetOptionValues(null, false);

                //説明
                _ItemDetail.transform.Find("DetailItemDescription").GetComponent <Text>().text = "";
            }
        }