Exemplo n.º 1
0
    protected override void OnShow(object data)
    {
        base.OnShow(data);
        m_lstTransfers.Clear();
        m_lst_TabType.Clear();
        if (data is LangTalkData)
        {
            isNpcTransfer     = true;
            m_label_name.text = "驿站车夫";
            m_langTalkData    = (LangTalkData)data;
            for (int i = 0; i < m_langTalkData.buttons.Count; i++)
            {
                uint id     = 0;
                uint sortID = 0;
                if (uint.TryParse(m_langTalkData.buttons[i].strBtnName, out id))
                {
                    TransferDatabase transf = GameTableManager.Instance.GetTableItem <TransferDatabase>(id);
                    if (transf != null)
                    {
                        if (!m_lst_TabType.Contains(transf.type))
                        {
                            m_lst_TabType.Add(transf.type);
                        }
                        sortID = transf.sortID;
                    }

                    m_lstTransfers.Add(new TransferData()
                    {
                        btnIndex = m_langTalkData.buttons[i].nindex,
                        tabID    = id,
                        isNpc    = true,
                        step     = m_langTalkData.strStep,
                        sortID   = transf.sortID,
                    });
                }
            }
            if (m_lstTransfers != null)
            {
                m_lstTransfers.Sort();
            }
        }
        else
        {
            isNpcTransfer     = false;
            m_label_name.text = "世界地图";
            for (int i = 0; i < lstTransmis.Count; i++)
            {
                if (!m_lst_TabType.Contains(lstTransmis[i].type))
                {
                    m_lst_TabType.Add(lstTransmis[i].type);
                }
            }
            StructDatas();
        }
        InitGrid();
    }
Exemplo n.º 2
0
        /// <summary>
        /// 通过[地图ID]二分快速查表
        /// </summary>
        /// <param name="mapid">地图ID</param>
        /// <returns></returns>
        public static TransferDatabase Query(this List <TransferDatabase> sorted, uint mapid)
        {
            var key = new TransferDatabase()
            {
                mapid = mapid
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(TransferDatabase));
        }
Exemplo n.º 3
0
    void GotoMap(int mapID)
    {
        if (mapID != 0)
        {
            IMapSystem mapSystem = Client.ClientGlobal.Instance().GetMapSystem();
            if (mapSystem.GetMapID() == mapID)
            {
                //你就在这个场景
                TipsManager.Instance.ShowTipsById(514);
                return;
            }
            Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
            if (cs != null)
            {
                cs.GetCombatRobot().Stop();// 停止挂机
            }
            TransferDatabase tdb = GameTableManager.Instance.GetTableItem <TransferDatabase>((uint)mapID);
            if (tdb != null)
            {
                if (!MainPlayerHelper.IsHasEnoughMoney(tdb.costType, tdb.costValue, true))
                {
                    return;
                }
            }
            //DataManager.Manager<SliderDataManager>().SetSliderDelagate(() =>
            //{

            if (!KHttpDown.Instance().SceneFileExists((uint)mapID))
            {
                //打开下载界面
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
                HideSelf();
                return;
            }

            IMapSystem ms = ClientGlobal.Instance().GetMapSystem();
            if (ms != null)
            {
                ms.RequestEnterMap((uint)mapID, 1);
            }
            //}, null, 3f);

            HideSelf();
        }
        m_ctor_bgContent.SetVisible(false);
        m_btn_ColliderMask.gameObject.SetActive(false);
    }
Exemplo n.º 4
0
    public void SetData(TransferData data)
    {
        TransferDatabase tab = GameTableManager.Instance.GetTableItem <TransferDatabase>(data.tabID);

        if (tab != null)
        {
            if (m_lableName != null)
            {
                m_lableName.text = tab.strTransmitMap;
            }
            RefreshBg(tab.bgResID);
            if (m_lableCost != null)
            {
                m_lableCost.text = tab.costValue.ToString();
            }
        }
    }
Exemplo n.º 5
0
    void SetSelectGrid(int index)
    {
        if (index < m_lstTransfers.Count)
        {
            TransferData m_data = m_lstTransfers[index];
            if (m_data != null)
            {
                if (m_data.isNpc)
                {
                    TransferDatabase transferdata = GameTableManager.Instance.GetTableItem <TransferDatabase>(m_data.tabID);
                    if (!KHttpDown.Instance().SceneFileExists(transferdata.mapid))
                    {
                        //打开下载界面
                        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
                        HideSelf();
                        return;
                    }

                    NetService.Instance.Send(new stDialogSelectScriptUserCmd_C()
                    {
                        step    = m_data.step,
                        dwChose = m_data.btnIndex,
                    });
                }
                else
                {
                    TransferDatabase transferdata = GameTableManager.Instance.GetTableItem <TransferDatabase>(m_data.tabID);
                    if (transferdata == null)
                    {
                        return;
                    }
                    string strMsg = string.Format("是否花费 [ff0000]{0}{1}[-] 传送到{2}", transferdata.costValue, ((ClientMoneyType)transferdata.costType).GetEnumDescription(), transferdata.strTransmitMap);
                    TipsManager.Instance.ShowTipWindow(Client.TipWindowType.CancelOk, strMsg, delegate()
                    {
                        DataManager.Manager <TeamDataManager>().TeamMemberCheckAndCancelFollow();//取消队员跟随

                        Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
                        if (cs != null)
                        {
                            cs.GetCombatRobot().Stop();// 停止挂机
                        }


                        ClientMoneyType montype = (ClientMoneyType)transferdata.costType;
                        if (MainPlayerHelper.IsHasEnoughMoney(montype, transferdata.costValue))
                        {
                            Client.IMapSystem mapsys = Client.ClientGlobal.Instance().GetMapSystem();
                            if (mapsys != null)
                            {
                                if (mapsys.GetMapID() == transferdata.mapid)
                                {
                                    //你就在这个场景
                                    TipsManager.Instance.ShowTipsById(514);
                                    return;
                                }

                                //httpdown
                                if (!KHttpDown.Instance().SceneFileExists(transferdata.mapid))
                                {
                                    //打开下载界面
                                    DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
                                    return;
                                }


                                mapsys.RequestEnterMap(transferdata.mapid, 1);
                                HideSelf();
                            }
                        }
                    });
                }
            }
        }
    }