예제 #1
0
        private static void SingleSceneDataToMultiSceneData_EntryGate(PlayerData playerData)
        {
            if (!IsSingleSceneDataToMultiSceneData_EntryGate(playerData))
            {
                return;
            }

            List <GateData> gateList = new List <GateData>();

            for (int i = 0; i < playerData.playerZoo.entryGateList.Count; i++)
            {
                GateData gateData = new GateData {
                    entryID = playerData.playerZoo.entryGateList[i].entryID,
                    level   = playerData.playerZoo.entryGateList[i].level,
                };
                gateList.Add(gateData);
            }

            EntryGateData_MS entryGateData_MS = new EntryGateData_MS
            {
                entryGateList     = gateList,
                entryTicketsLevel = playerData.playerZoo.entryTicketsLevel,
                sceneID           = GameConst.First_SceneID
            };

            playerData.playerZoo.entryGateList_MS.Clear();
            playerData.playerZoo.entryGateList_MS.Add(entryGateData_MS);
            playerData.playerZoo.entryTicketsLevel = UFrame.Const.Invalid_Int;
            playerData.playerZoo.entryGateList.Clear();
        }
        public void SetDefaultEntryGateData(int sceneID)
        {
            GlobalDataManager.GetInstance().logicTableEntryGate.AddScene(sceneID);
            var sortGateIDs = GlobalDataManager.GetInstance().logicTableEntryGate.GetSortGateIDs(sceneID);

            numEntryGate = 1;
            GateData entryGateData = new GateData
            {
                entryID = sortGateIDs[0],
                level   = 1
            };

            EntryGateData_MS entryGateData_MS = new EntryGateData_MS();

            entryGateData_MS.sceneID           = sceneID;
            entryGateData_MS.entryTicketsLevel = 1;
            entryGateData_MS.entryGateList.Add(entryGateData);
            this.entryGateList_MS.Add(entryGateData_MS);
        }
        /// <summary>
        /// 获取多场景数据结构中的当前售票口数据Data
        /// </summary>
        /// <returns></returns>
        public EntryGateData_MS GetEntryDateDataIDIndexOfDataIdx(int sceneID = -1)
        {
            if (sceneID == -1)
            {
                sceneID = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID;
            }
            EntryGateData_MS entryGateData_MS = null;
            var entryGateList_MS = GlobalDataManager.GetInstance().playerData.playerZoo.entryGateList_MS;

            for (int i = 0; i < entryGateList_MS.Count; i++)
            {
                entryGateData_MS = entryGateList_MS[i];
                if (entryGateData_MS.sceneID == sceneID)
                {
                    return(entryGateData_MS);
                }
            }

            string e = string.Format("场景为{0}的售票口数据为空", sceneID);

            throw new System.Exception(e);
            return(null);
        }