コード例 #1
0
ファイル: TaskItemContainer.cs プロジェクト: mengtest/MyWuXia
        public void UpdateData(TaskData data)
        {
            taskData = data;
            scene    = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", taskData.BelongToSceneId);
            npc      = JsonManager.GetInstance().GetMapping <NpcData>("Npcs", taskData.BelongToNpcId);
            JObject areaNames = JsonManager.GetInstance().GetJson("AreaNames");

            areaName = areaNames[scene.BelongToAreaName] != null ? areaNames[scene.BelongToAreaName]["Name"].ToString() : "";
        }
コード例 #2
0
 public static void Show(SceneData data, List <string> ids)
 {
     if (Ctrl == null)
     {
         InstantiateView("Prefabs/UI/MainTool/CityScenePanelView", "CityScenePanelCtrl");
         Ctrl.FadeIn();
     }
     Ctrl.UpdateData(data, ids);
     Ctrl.RefreshView();
 }
コード例 #3
0
        private IEnumerator LoadScene(SceneData sceneData)
        {
            AsyncOperation operation = SceneManager.LoadSceneAsync(sceneData.BuildIndex, LoadSceneMode.Single);

            while (!operation.isDone)
            {
                yield return(null);
            }
            Debug.Log("SCENE LOADED: " + sceneData.name);
        }
コード例 #4
0
 public void UpdateData(TaskData data)
 {
     taskData      = data;
     currentDialog = taskData.GetCurrentDialog();
     scene         = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", taskData.BelongToSceneId);
     npc           = JsonManager.GetInstance().GetMapping <NpcData>("Npcs", taskData.BelongToNpcId);
     areaNames     = JsonManager.GetInstance().GetJson("AreaNames");
     areaName      = areaNames[scene.BelongToAreaName] != null ? areaNames[scene.BelongToAreaName]["Name"].ToString() : "";
     EventTriggerListener.Get(ScoutBtn.gameObject).onClick = onClick;
 }
コード例 #5
0
 public IEnumerator LoadLevelScene(int levelNo, bool unloadActiveScene)
 {
     if (levelNo - 1 >= levelsSceneData.Count)
     {
         Debug.LogWarning("levelsSceneData list does not have level" + levelNo + "!");
         yield break;
     }
     currentLoadedSceneData = levelsSceneData[levelNo - 1];
     GameManager.Cur.EventCtrl.onLevelSceneLoadStarted?.Invoke(levelNo);
     yield return(StartCoroutine(LoadSceneAdditive(currentLoadedSceneData, true, unloadActiveScene)));
 }
コード例 #6
0
        private IEnumerator LoadSceneAdditive(SceneData sceneData, bool setSceneActive, bool unloadActiveScene)
        {
            GameManager.Cur.EventCtrl.onSceneLoadStarted?.Invoke();

            Scene preActiveScene = SceneManager.GetActiveScene();

            SetActiveScene(gameManagerSceneData);

            if (unloadActiveScene)
            {
                if (preActiveScene.isLoaded)
                {
                    string         sceneName       = preActiveScene.name;
                    AsyncOperation unloadOperation = SceneManager.UnloadSceneAsync(preActiveScene.buildIndex);
                    while (!unloadOperation.isDone)
                    {
                        if (GameManager.Cur.GameManagerCanvas != null)
                        {
                            float unloadProgress = Mathf.Clamp01(unloadOperation.progress) * 0.5f / 0.9f;
                            GameManager.Cur.GameManagerCanvas.loadingPanel.bar.SetValue(unloadProgress);
                        }
                        yield return(null);
                    }
                    Debug.Log("SCENE UNLOADED: " + sceneName);
                }
            }

            AsyncOperation loadOperation = SceneManager.LoadSceneAsync(sceneData.BuildIndex, LoadSceneMode.Additive);

            loadOperation.allowSceneActivation = false;
            while (!loadOperation.isDone)
            {
                if (GameManager.Cur.GameManagerCanvas != null)
                {
                    float loadProgress = Mathf.Clamp01(loadOperation.progress) * 0.5f / 0.9f + 0.5f;
                    GameManager.Cur.GameManagerCanvas.loadingPanel.bar.SetValue(loadProgress);
                }

                if (loadOperation.progress >= 0.9f)
                {
                    Debug.Log("SCENE LOADED: " + sceneData.Name);
                    loadOperation.allowSceneActivation = true;
                }
                yield return(null);
            }

            if (setSceneActive)
            {
                SetActiveScene(sceneData);
            }
        }
コード例 #7
0
        /// <summary>
        /// 前往城镇
        /// </summary>
        /// <param name="fromIndex">From index.</param>
        /// <param name="toIndex">To index.</param>
        public void GoToCity(int fromIndex, int toIndex)
        {
            SceneData toScene = null;

            ModifyResources();
            db = OpenDb();
            string           indexToId = JsonManager.GetInstance().GetMapping <string>("SceneIndexToIds", toIndex.ToString());
            SqliteDataReader sqReader  = db.ExecuteQuery("select CityId from EnterCityTable where CityId == '" + indexToId + "' and BelongToRoleId = '" + currentRoleId + "'");

            if (sqReader.HasRows)
            {
                FloydResult result = floyd.GetResult(fromIndex, toIndex);
                //查询银子是否足够支付路费
                sqReader = db.ExecuteQuery("select Id, ResourcesData from WorkshopResourceTable where BelongToRoleId = '" + currentRoleId + "'");
                List <ResourceData> resources = null;
                if (sqReader.Read())
                {
                    string resourcesStr = sqReader.GetString(sqReader.GetOrdinal("ResourcesData"));
                    resourcesStr = resourcesStr.IndexOf("[") == 0 ? resourcesStr : DESStatics.StringDecder(resourcesStr);
                    resources    = JsonManager.GetInstance().DeserializeObject <List <ResourceData> >(resourcesStr);
                    //查询目前的银子余额
                    ResourceData resource = resources.Find(re => re.Type == ResourceType.Silver);
                    if (resource != null)
                    {
                        if (resource.Num >= result.Distance)
                        {
                            resource.Num -= result.Distance;
                            //扣钱
                            db.ExecuteQuery("update WorkshopResourceTable set ResourcesData = '" + DESStatics.StringEncoder(JsonManager.GetInstance().SerializeObject(resources)) + "' where Id = " + sqReader.GetInt32(sqReader.GetOrdinal("Id")));
                            toScene = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", GetCityIdByIndex(toIndex));
                            Debug.LogWarning(GetCityIdByIndex(toIndex) + "," + toScene.Id + "," + toScene.Name);
                        }
                        else
                        {
                            AlertCtrl.Show("银子不够支付路费!");
                        }
                    }
                }
            }
            else
            {
                AlertCtrl.Show("并没有开启前方传送点!");
            }
            db.CloseSqlConnection();
            if (toScene != null)
            {
                Messenger.Broadcast <SceneData>(NotifyTypes.GoToCityEcho, toScene);
            }
        }
コード例 #8
0
ファイル: BaseDb.cs プロジェクト: mengtest/MyWuXia
        /// <summary>
        /// 查询城镇开启情况列表
        /// </summary>
        public void GetCitySceneMenuData(string cityId)
        {
            List <string> openedCityIds = new List <string>();

            db = OpenDb();
            SqliteDataReader sqReader = db.ExecuteQuery("select CityId from EnterCityTable where BelongToRoleId = '" + currentRoleId + "'");

            while (sqReader.Read())
            {
                openedCityIds.Add(sqReader.GetString(sqReader.GetOrdinal("CityId")));
            }
            db.CloseSqlConnection();
            SceneData scene = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", cityId);

            scene.MakeJsonToModel();
            CityScenePanelCtrl.Show(scene, openedCityIds);
        }
コード例 #9
0
ファイル: BaseDb.cs プロジェクト: mengtest/MyWuXia
        /// <summary>
        /// 记录进入的城镇
        /// </summary>
        /// <param name="areaName">Area name.</param>
        public void CheckEnterCity(string cityId)
        {
            SceneData scene = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", cityId);

            //战斗据点不处理任何增加数据
            if (scene.IsJustFightScene)
            {
                return;
            }
            //非战斗城镇才需要检测各项数据
            if (!scene.IsJustFightScene)
            {
                //检测是否有新的可以招募的侠客
                CheckNewRoleIdsOfWinShop(cityId);
                //初始化用于判定新增结识侠客的id列表
                CreateRoleIdOfWinShopNewFlagList();
                //检测工坊是否有新的生产单元
                CheckNewWorkshopItems(cityId);
                //检测是否有新的可以打造的兵器
                CheckNewWeaponIdsOfWorkshop(cityId);
                //初始化用于判定新增锻造兵器的id列表
                CreateWeaponIdOfWorkShopNewFlagList();
                //检测是否发现新的秘籍
                CheckNewBooksOfForbiddenArea(cityId);
                //初始化用于判定秘境中新增秘籍的id列表
                CreateBookIdOfCurrentForbiddenAreaNewFlagList(cityId);
                //将背包里的辎重箱资源存入工坊
                BringResourcesToWorkshop();
            }
            db = OpenDb();
            SqliteDataReader sqReader = db.ExecuteQuery("select Id from EnterCityTable where CityId = '" + cityId + "' and BelongToRoleId = '" + currentRoleId + "'");

            if (!sqReader.HasRows)
            {
                db.ExecuteQuery("insert into EnterCityTable (CityId, BelongToRoleId) values('" + cityId + "', '" + currentRoleId + "')");
                //根据开启的城镇数计算工坊的家丁数上限和干粮上限
                sqReader = db.ExecuteQuery("select count(*) as num from EnterCityTable where BelongToRoleId = '" + currentRoleId + "'");
                int num            = 0;
                int maxWorkerNum   = 0;
                int areaFoodMaxNum = 0;
                if (sqReader.Read())
                {
                    num = sqReader.GetInt32(sqReader.GetOrdinal("num"));
                    //新到一个城镇会增加5个家丁
                    maxWorkerNum = Mathf.Clamp(40 + num * 5, 45, 200);                     //上限200
                    //新到一个城镇会增加10个干粮上限
                    areaFoodMaxNum = Mathf.Clamp(20 + num * 10, 30, 300);                  //上限300
                }
                if (maxWorkerNum > 0)
                {
                    sqReader = db.ExecuteQuery("select Id, WorkerNum, MaxWorkerNum from WorkshopResourceTable where BelongToRoleId = '" + currentRoleId + "'");
                    if (sqReader.Read())
                    {
                        int id              = sqReader.GetInt32(sqReader.GetOrdinal("Id"));
                        int oldWorkerNum    = sqReader.GetInt32(sqReader.GetOrdinal("WorkerNum"));
                        int oldMaxWorkerNum = sqReader.GetInt32(sqReader.GetOrdinal("MaxWorkerNum"));
                        if (oldMaxWorkerNum < maxWorkerNum)
                        {
                            //累加空闲家丁,更新家丁上限
                            db.ExecuteQuery("update WorkshopResourceTable set WorkerNum = " + (oldWorkerNum + (maxWorkerNum - oldMaxWorkerNum)) + ", MaxWorkerNum = " + maxWorkerNum + " where Id = '" + id + "'");
                        }
                    }
                }
                if (areaFoodMaxNum > 0)
                {
                    sqReader = db.ExecuteQuery("select Id, Data from UserDatasTable where BelongToRoleId = '" + currentRoleId + "'");
                    if (sqReader.Read())
                    {
                        UserData user = JsonManager.GetInstance().DeserializeObject <UserData>(sqReader.GetString(sqReader.GetOrdinal("Data")));
                        user.AreaFood.MaxNum = areaFoodMaxNum;
                        db.ExecuteQuery("Update UserDatasTable set Data = '" + JsonManager.GetInstance().SerializeObjectDealVector(user) + "' where Id = " + sqReader.GetInt32(sqReader.GetOrdinal("Id")));
                        if (UserModel.CurrentUserData != null)
                        {
                            UserModel.CurrentUserData.AreaFood.MaxNum = user.AreaFood.MaxNum;
                        }
                    }
                }
            }
            db.CloseSqlConnection();
        }
コード例 #10
0
        /// <summary>
        /// 记录进入的城镇
        /// </summary>
        /// <param name="areaName">Area name.</param>
        public void CheckEnterCity(string cityId)
        {
            SceneData scene = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", cityId);

            //战斗据点不处理任何增加数据
            if (scene.IsJustFightScene)
            {
                return;
            }
            //非战斗城镇才需要检测各项数据
            if (!scene.IsJustFightScene)
            {
                //检测是否有新的可以招募的侠客
                CheckNewRoleIdsOfWinShop(cityId);
                //初始化用于判定新增结识侠客的id列表
                CreateRoleIdOfWinShopNewFlagList();
                //检测工坊是否有新的生产单元
                CheckNewWorkshopItems(cityId);
                //检测是否有新的可以打造的兵器
                CheckNewWeaponIdsOfWorkshop(cityId);
                //初始化用于判定新增锻造兵器的id列表
                CreateWeaponIdOfWorkShopNewFlagList();
                //检测是否发现新的秘籍
                CheckNewBooksOfForbiddenArea(cityId);
                //初始化用于判定秘境中新增秘籍的id列表
                CreateBookIdOfCurrentForbiddenAreaNewFlagList(cityId);
                //将背包里的辎重箱资源存入工坊
                BringResourcesToWorkshop();
            }
            string addDataMsg = "";

            db = OpenDb();
            SqliteDataReader sqReader;

            //处理新的家丁数
            //兼容老版本
            if (GetMaxWorkerNum() == 0)
            {
                sqReader = db.ExecuteQuery("select WorkerNum, MaxWorkerNum from WorkshopResourceTable where BelongToRoleId = '" + currentRoleId + "'");
                if (sqReader.Read())
                {
                    int oldWorkerNum    = sqReader.GetInt32(sqReader.GetOrdinal("WorkerNum"));
                    int oldMaxWorkerNum = sqReader.GetInt32(sqReader.GetOrdinal("MaxWorkerNum"));
                    SetMaxWorkerNum(oldMaxWorkerNum);
                    SetWorkerNum(oldWorkerNum);
                }
            }
            sqReader = db.ExecuteQuery("select Id from EnterCityTable where CityId = '" + cityId + "' and BelongToRoleId = '" + currentRoleId + "'");
            if (!sqReader.HasRows)
            {
                db.ExecuteQuery("insert into EnterCityTable (CityId, BelongToRoleId) values('" + cityId + "', '" + currentRoleId + "')");
                //根据开启的城镇数计算工坊的家丁数上限和干粮上限
                sqReader = db.ExecuteQuery("select count(*) as num from EnterCityTable where BelongToRoleId = '" + currentRoleId + "'");
                int num            = 0;
                int maxWorkerNum   = 0;
                int areaFoodMaxNum = 0;
                if (sqReader.Read())
                {
                    num = sqReader.GetInt32(sqReader.GetOrdinal("num"));
                    //新到一个城镇会增加5个家丁
                    maxWorkerNum = Mathf.Clamp(GetPlusWorkerNum() + 10 + num * 5, 15, 500 + GetPlusWorkerNum()); //上限500
                    //新到一个城镇会增加10个干粮上限
                    areaFoodMaxNum = Mathf.Clamp(30 + num * 10, 30, 600);                                        //上限600
                    if (cityId != "00001")
                    {
                        //新手村不提示这个
                        if (maxWorkerNum < (500 + GetPlusWorkerNum()))
                        {
                            addDataMsg += string.Format("家丁上限增加5, 总数:{0}", maxWorkerNum);
                        }
                        if (areaFoodMaxNum < 600)
                        {
                            addDataMsg += string.Format("\n可携带干粮上限增加10, 总数:{0}", areaFoodMaxNum);
                        }
                    }
                }
                if (maxWorkerNum > 0)
                {
                    sqReader = db.ExecuteQuery("select Id, WorkerNum, MaxWorkerNum from WorkshopResourceTable where BelongToRoleId = '" + currentRoleId + "'");
                    if (sqReader.Read())
                    {
                        int id = sqReader.GetInt32(sqReader.GetOrdinal("Id"));
//						int oldWorkerNum = sqReader.GetInt32(sqReader.GetOrdinal("WorkerNum"));
//						int oldMaxWorkerNum = sqReader.GetInt32(sqReader.GetOrdinal("MaxWorkerNum"));
                        int oldWorkerNum    = GetWorkerNum();
                        int oldMaxWorkerNum = GetMaxWorkerNum();
                        if (oldMaxWorkerNum < maxWorkerNum)
                        {
                            //累加空闲家丁,更新家丁上限
                            db.ExecuteQuery("update WorkshopResourceTable set WorkerNum = " + (oldWorkerNum + (maxWorkerNum - oldMaxWorkerNum)) + ", MaxWorkerNum = " + maxWorkerNum + " where Id = '" + id + "'");
                            SetMaxWorkerNum(maxWorkerNum);
                            SetWorkerNum((oldWorkerNum + (maxWorkerNum - oldMaxWorkerNum)));
                        }
                    }
                }
                if (areaFoodMaxNum > 0)
                {
                    sqReader = db.ExecuteQuery("select Id, Data from UserDatasTable where BelongToRoleId = '" + currentRoleId + "'");
                    if (sqReader.Read())
                    {
                        UserData user = JsonManager.GetInstance().DeserializeObject <UserData>(sqReader.GetString(sqReader.GetOrdinal("Data")));
                        user.AreaFood.MaxNum = areaFoodMaxNum;
                        db.ExecuteQuery("Update UserDatasTable set Data = '" + JsonManager.GetInstance().SerializeObjectDealVector(user) + "' where Id = " + sqReader.GetInt32(sqReader.GetOrdinal("Id")));
                        if (UserModel.CurrentUserData != null)
                        {
                            UserModel.CurrentUserData.AreaFood.MaxNum = user.AreaFood.MaxNum;
                        }
                    }
                }
                switch (cityId)
                {
                case "0002":     //临安集市
                case "1001":     //观前街
                case "2002":     //归云庄
                case "6001":     //金国领地
                    sqReader = db.ExecuteQuery("select Id, Data from UserDatasTable where BelongToRoleId = '" + currentRoleId + "'");
                    if (sqReader.Read())
                    {
                        UserData user = JsonManager.GetInstance().DeserializeObject <UserData>(sqReader.GetString(sqReader.GetOrdinal("Data")));
                        user.MaxRoleNum = Mathf.Clamp(user.MaxRoleNum + 1, 2, 6);
                        db.ExecuteQuery("Update UserDatasTable set Data = '" + JsonManager.GetInstance().SerializeObjectDealVector(user) + "' where Id = " + sqReader.GetInt32(sqReader.GetOrdinal("Id")));
                        if (UserModel.CurrentUserData != null)
                        {
                            UserModel.CurrentUserData.MaxRoleNum = user.MaxRoleNum;
                            if (addDataMsg != "")
                            {
                                addDataMsg += "\n";
                            }
                            addDataMsg += string.Format("侠客上限增加1, 总数:{0}", user.MaxRoleNum);
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            db.CloseSqlConnection();
            if (!string.IsNullOrEmpty(addDataMsg))
            {
                AlertCtrl.Show(addDataMsg);
            }
        }
コード例 #11
0
 public void UpdateData(SceneData data, List <string> ids)
 {
     sceneData = data;
     cityIds   = ids;
     PlayBgm();
 }
コード例 #12
0
        /// <summary>
        /// 用户相关消息
        /// </summary>
        public static void UserNotifyInit()
        {
            Messenger.AddListener <System.Action <UserData> >(NotifyTypes.CallUserData, (callback) => {
                callUserDataCallback = callback;
                DbManager.Instance.CallUserData();
            });

            Messenger.AddListener <System.Action <UserData> >(NotifyTypes.UpdateUserData, (callback) => {
                if (UserModel.CurrentUserData != null)
                {
                    callUserDataCallback = callback;
                    DbManager.Instance.UpdateUserData(JsonManager.GetInstance().SerializeObjectDealVector(UserModel.CurrentUserData));
                }
            });

            Messenger.AddListener <JObject>(NotifyTypes.CallUserDataEcho, (obj) => {
                if (callUserDataCallback != null)
                {
                    JArray data = (JArray)obj["data"];
                    UserModel.CurrentUserData              = JsonManager.GetInstance().DeserializeObject <UserData>(data[1].ToString());
                    UserModel.CurrentUserData.Id           = data[0].ToString();
                    UserModel.CurrentUserData.AreaFood.Num = (int)data[2];
                    UserModel.CurrentUserData.TimeAngle    = (float)data[3];
                    UserModel.CurrentUserData.TimeTicks    = (long)data[4];
                    FramePanelCtrl.TimePlay(UserModel.CurrentUserData.TimeAngle, UserModel.CurrentUserData.TimeTicks);                     //初始化时辰时间戳
                    callUserDataCallback(UserModel.CurrentUserData);
                    callUserDataCallback = null;
                }
            });

            Messenger.AddListener <string, Vector2, System.Action <UserData> >(NotifyTypes.UpdateUserDataAreaInfo, (areaName, pos, callback) => {
                if (UserModel.CurrentUserData != null)
                {
                    UserModel.CurrentUserData.PositionStatu        = UserPositionStatusType.InArea;
                    UserModel.CurrentUserData.CurrentAreaSceneName = areaName;
                    UserModel.CurrentUserData.CurrentAreaX         = (int)pos.x;
                    UserModel.CurrentUserData.CurrentAreaY         = (int)pos.y;
                    Messenger.Broadcast <System.Action <UserData> >(NotifyTypes.UpdateUserData, callback);
                }
            });

            Messenger.AddListener <string>(NotifyTypes.UpdateUserDataCityInfo, (cityId) => {
                if (UserModel.CurrentUserData != null)
                {
                    SceneData scene = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", cityId);
                    //战斗据点场景不缓存
                    if (!scene.IsJustFightScene)
                    {
                        UserModel.CurrentUserData.PositionStatu      = UserPositionStatusType.InCity;
                        UserModel.CurrentUserData.CurrentCitySceneId = cityId;
                    }
                }
            });

            Messenger.AddListener <string, Vector2, System.Action <UserData> >(NotifyTypes.UpdateUserDataAreaPos, (areaName, pos, callback) => {
                if (UserModel.CurrentUserData != null)
                {
                    UserModel.CurrentUserData.CurrentAreaSceneName = areaName;
                    UserModel.CurrentUserData.CurrentAreaX         = (int)pos.x;
                    UserModel.CurrentUserData.CurrentAreaY         = (int)pos.y;
                    Messenger.Broadcast <System.Action <UserData> >(NotifyTypes.UpdateUserData, callback);
                }
            });

            Messenger.AddListener(NotifyTypes.PlayBgm, () => {
                if (UserModel.CurrentUserData != null)
                {
                    switch (UserModel.CurrentUserData.PositionStatu)
                    {
                    case UserPositionStatusType.InArea:
                        if (AreaModel.AreaMainScript)
                        {
                            AreaModel.AreaMainScript.PlayBgm();
                        }
                        break;

                    case UserPositionStatusType.InCity:
                        CityScenePanelCtrl.MakePlayBgm();
                        break;

                    default:
                        break;
                    }
                }
            });

            Messenger.AddListener(NotifyTypes.EnterGame, () => {
                DbManager.Instance.ResetTasks();                 //初始化任务
                if (DbManager.Instance.GetRecordNum() > 0)
                {
//					MainPanelCtrl.Hide();
//					RecordListPanelCtrl.Hide();
//					SettingPanelCtrl.Hide();
                    UIModel.CloseAllWindows();
                    Messenger.Broadcast <bool>(NotifyTypes.CallRoleInfoPanelData, false);
                    Messenger.Broadcast <System.Action <UserData> >(NotifyTypes.CallUserData, (userData) => {
                        Messenger.Broadcast <string>(NotifyTypes.GoToScene, userData.CurrentAreaSceneName);
                    });
                }
                else
                {
                    Messenger.Broadcast <string>(NotifyTypes.ShowCreateHostRolePanel, "role_0");                    //第一个角色创建
                }
            });

            Messenger.AddListener <string>(NotifyTypes.ShowCreateHostRolePanel, (id) => {
//				MainPanelCtrl.Hide();
//				RecordListPanelCtrl.Hide();
//				SettingPanelCtrl.Hide();
                UIModel.CloseAllWindows();
                CreateHostRolePanelCtrl.Show(id);
            });

            Messenger.AddListener <RoleData>(NotifyTypes.CreateHostRole, (role) => {
                PlayerPrefs.SetString("CurrentRoleId", role.Id);                 //记录当前角色存档id
                DbManager.Instance.SetCurrentRoleId(role.Id);
                DbManager.Instance.AddNewRecord(role.Id, role.Name, "{}", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                //创建用户数据
                UserData userData             = new UserData();
                userData.AreaFood             = new ItemData();
                userData.AreaFood.Num         = 0;
                userData.AreaFood.MaxNum      = 30;
                userData.PositionStatu        = UserPositionStatusType.InCity;
                userData.CurrentAreaSceneName = "Area00";
                userData.CurrentCitySceneId   = "00001";
                userData.CurrentAreaX         = 15;
                userData.CurrentAreaY         = 15;
                DbManager.Instance.AddNewUserData(JsonManager.GetInstance().SerializeObjectDealVector(userData), userData.AreaFood.Num, role.Id, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                //创建角色数据
                role.ResourceBookDataIds.Clear();
                if (DbManager.Instance.AddNewRole(role.Id, JsonManager.GetInstance().SerializeObjectDealVector(role), (int)RoleStateType.InTeam, 0, role.HometownCityId, role.Id, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")))
                {
//					DbManager.Instance.AddNewWeapon(role.ResourceWeaponDataId, role.Id);
//					DbManager.Instance.AddNewWeapon("1");
//					DbManager.Instance.AddNewWeapon("2");
//					DbManager.Instance.AddNewWeapon("3");
                    CreateHostRolePanelCtrl.MakeStoryContinue(role.Name);
                }
            });

            Messenger.AddListener(NotifyTypes.GetRecordListData, () => {
                DbManager.Instance.GetRecordListData();
            });

            Messenger.AddListener <List <JArray> >(NotifyTypes.GetRecordListDataEcho, (data) => {
                RecordListPanelCtrl.Show(data);
            });

            Messenger.AddListener(NotifyTypes.ShowMainPanel, () => {
//				MainPanelCtrl.Hide();
//				RecordListPanelCtrl.Hide();
//				SettingPanelCtrl.Hide();
                UIModel.CloseAllWindows();
                MainPanelCtrl.Show();
            });

            Messenger.AddListener <bool>(NotifyTypes.ShowSettingPanel, (flag) => {
                //战斗时不能打开设置界面
                if (BattleMainPanelCtrl.Ctrl != null)
                {
                    return;
                }
                SettingPanelCtrl.Show(flag);
            });
        }
コード例 #13
0
 private void SetActiveScene(SceneData sceneData)
 {
     SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(sceneData.BuildIndex));
     Debug.Log("ACTIVE SCENE SET: " + sceneData.name);
 }
コード例 #14
0
 public IEnumerator LoadMainMenuScene(bool unloadActiveScene)
 {
     currentLoadedSceneData = mainMenuSceneData;
     GameManager.Cur.EventCtrl.onMainMenuSceneLoadStarted?.Invoke();
     yield return(StartCoroutine(LoadSceneAdditive(currentLoadedSceneData, true, unloadActiveScene)));
 }
コード例 #15
0
        /// <summary>
        /// 获取杂货铺商品数据
        /// </summary>
        /// <param name="cityId">City identifier.</param>
        public void GetStorePanelData(string cityId)
        {
            SceneData currentScene = JsonManager.GetInstance().GetMapping <SceneData>("Scenes", cityId);

            GetStoreData(currentScene.ResourceStoreId);
        }