예제 #1
0
        private void OnRegionDownload(RegionList list)
        {
            loadingUI.Hide();

            if (list == null)
            {
                loginUI.ShowError("Login Error!");
                loginUI.Show();

                return;
            }

            List <BlockListData> uiDataList = new List <BlockListData>();

            for (int i = 0; i < list.Regions.Count; i++)
            {
                RegionList.Region region = list.Regions[i];

                RegionItemData data = new RegionItemData();
                data.name = region.RegionName;
                data.data = region;

                uiDataList.Add(data);
            }
            regionList.SetData(uiDataList, 1, uiDataList.Count);

            regionList.Show();
        }
예제 #2
0
        public void ShowUI(System.Action <int> cbChangePage, System.Action <BaseResource> cbResource, System.Action cbClose = null)
        {
            if (isShowUI)
            {
                return;
            }

            isShowUI = true;


            cbClickChangePage = cbChangePage;
            cbClickResource   = cbResource;
            cbClickClose      = cbClose;

            // 放在视线位置
            Vector3 headPosition  = Camera.main.transform.position;
            Vector3 gazeDirection = Camera.main.transform.forward;
            float   scale         = 1;

            Vector3 pos = Vector3.zero;

            if (inputManager.FocusedObject != null)
            {
                float dis = Vector3.Distance(headPosition, inputManager.hitPoint);
                if (dis > 4)
                {
                    dis = 4;
                }

                pos = headPosition + gazeDirection * (dis - 0.3f);

                if (dis < 4)
                {
                    scale = dis / 4;
                }
            }
            else
            {
                pos = headPosition + gazeDirection * 4f;
            }
            gazeDirection.y = 0;

            ui.SetUISize(pos, gazeDirection, scale);


            ChangeUIData();

            ui.Show();

            ui.HideLoading();

            oldInputLayer          = inputManager.layerMask;
            inputManager.layerMask = LayerMask.GetMask("UI");
        }