public static bool GetConfig(string fieldName, object fieldValue, out ConfScene config) { DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_Scene", fieldName, fieldValue); if (sqReader != null) { try { sqReader.Read(); if (sqReader.HasRows) { config = GetConfByDic(sqReader); } else { config = null; return(false); } return(true); } catch (Exception ex) { SqliteDriver.SQLiteHelper.OnError(string.Format("Scene 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex)); } config = null; return(false); } config = null; return(false); }
public virtual void InitScene(object sceneData, IList <long> decoratorList, IList <long> taskObjectList, IList <long> officerIds) { this.m_sceneData = (ConfScene)sceneData; this.m_heroList = officerIds; LoadScene(this.m_sceneData.sceneInfo); LoadSceneObjects(decoratorList, taskObjectList); #if OFFICER_SYS GameSkillManager.Instance.CreatePoliceSkill(officerIds); #endif RegisterMainGameEvents(); }
/// <summary> /// 尝试创建游戏 /// </summary> /// <param name="sceneId"></param> public bool TryCreateGameScene(long sceneId, long taskConfID = -1) { this.m_taskConfID = taskConfID; m_sceneData = ConfScene.Get(sceneId); if (m_sceneData == null) { return(false); } return(true); }
private static ConfScene GetConfByDic(DataTable reader) { long id = reader.GetInt64(0); int keyExhibit = reader.GetInt32(1); int vitConsume = reader.GetInt32(2); int clickCount = reader.GetInt32(3); int secondGain = reader.GetInt32(4); string cameraParam = reader.GetString(5); long multiId = reader.GetInt64(6); string playModeIcon = reader.GetString(7); long[] props = (long[])reader.GetArrayData(8, 17); int exhibitTotal = reader.GetInt32(9); int exhibitTask = reader.GetInt32(10); int playMode = reader.GetInt32(11); string exhibitGroupId = reader.GetString(12); string sceneInfo = reader.GetString(13); long dropId = reader.GetInt64(14); int outputVit = reader.GetInt32(15); int outputCash = reader.GetInt32(16); int outputExp = reader.GetInt32(17); int outputMoney = reader.GetInt32(18); int difficulty = reader.GetInt32(19); string name = reader.GetString(20); string thumbnail = reader.GetString(21); string descs = reader.GetString(22); ConfScene new_obj_ConfScene = new ConfScene(id, keyExhibit, vitConsume, clickCount, secondGain, cameraParam, multiId, playModeIcon, props, exhibitTotal, exhibitTask, playMode, exhibitGroupId, sceneInfo, dropId, outputVit, outputCash, outputExp, outputMoney, difficulty, name, thumbnail, descs ); return(new_obj_ConfScene); }
void BuildTopCreateSceneByDifficult(long build_top_scene_group_id_) { long scene_id = FindObjSceneDataManager.LoadSceneIDForBuildTop(build_top_scene_group_id_); var temp_group_data = FindObjSceneDataManager.Instance.GetDataBySceneGroupID(build_top_scene_group_id_); if (null != temp_group_data) { m_group_data = temp_group_data; } if (scene_id < 0) { long scene_difficult_id = FindObjSceneDataManager.GetSceneDifficultID(build_top_scene_group_id_, m_group_data.m_lvl); long[] sceneid4random = ConfSceneDifficulty.Get(scene_difficult_id).sceneIds; int[] weights4random = ConfSceneDifficulty.Get(scene_difficult_id).sceneWeights; List <RateScene> scenes4rdm = new List <RateScene>(); for (int i = 0; i < sceneid4random.Length; ++i) { RateScene rs = new RateScene() { SceneID = sceneid4random[i], Rate = weights4random[i], }; scenes4rdm.Add(rs); } int idx = randomGetIdex(scenes4rdm); if (idx >= 0) { RateScene selected_scene = scenes4rdm[idx]; scene_id = selected_scene.SceneID; FindObjSceneDataManager.SaveSceneIDForBuildTop(build_top_scene_group_id_, scene_id); } } if (scene_id > 0) { this.m_scene_id = scene_id; m_s_info = ConfScene.Get(m_scene_id); m_time_cost_value = m_s_info.secondGain; m_vit_cost_value = m_s_info.vitConsume; } else { m_s_info = null; m_time_cost_value = 0; m_vit_cost_value = 0; } }
void CreateSceneBySpecial(long tsk_scene_id_) { this.m_scene_id = tsk_scene_id_; m_s_info = ConfScene.Get(m_scene_id); int cur_difficult = m_group_data.m_lvl; int play_mode = m_s_info.playMode; //场景特殊表 ConfSceneSpecial special_scene = ConfSceneSpecial.array.Find((item) => item.playMode == play_mode && item.difficulty == cur_difficult); m_special_scene_id = special_scene.id; m_time_cost_value = special_scene.secondGain; m_vit_cost_value = special_scene.vitConsume; }
/// <summary> /// 退出场景 /// </summary> private void OnLeaveScene() { if (this.m_currentScene != null) { if ((int)this.m_currentScene.SceneMode < 10) { this.m_currentScene.DestroyScene(); this.m_sceneData = null; } } InputModule.Instance.Enable = false; EngineCoreEvents.ResourceEvent.LeaveScene.SafeInvoke(); //BigWorldManager.Instance.LoadBigWorld(); }
private static void GetArrrayList() { if (cacheArray.Count <= 0) { DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_Scene"); if (sqReader != null) { while (sqReader.Read()) { ConfScene _conf = GetConfByDic(sqReader); cacheArray.Add(_conf); dic[_conf.id] = _conf; } resLoaded = true; } } }
public static bool GetConfig(long id, out ConfScene config) { if (dic.TryGetValue(id, out config)) { return(config != null); } if (cacheLoaded) { config = null; return(false); } DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_Scene", id); if (sqReader != null) { try { sqReader.Read(); if (sqReader.HasRows) { config = GetConfByDic(sqReader); } else { dic[id] = null; config = null; return(false); } dic[id] = config; return(true); } catch (Exception ex) { SqliteDriver.SQLiteHelper.OnError(string.Format("Scene 表找不到SN={0} 的数据\n{1}", id, ex)); } config = null; return(false); } else { config = null; return(false); } }
public void OnReflashBuildIcon() { ConfScene confScene = null; bool flag = TaskQueryManager.Instance.QueryTaskComplete(this.m_enterdata.m_taskID); if (!flag) { this.m_sceneTex.SetGray(true); this.m_sceneLab.color = new Color(0.54f, 0.54f, 0.54f); confScene = ConfScene.Get(this.m_enterdata.m_sceneID); this.m_buildState = 0; } else { this.m_sceneLab.color = Color.white; this.m_sceneTex.SetGray(false); long sceneID = TaskQueryManager.Instance.CheckBuildIsInTask(this.m_enterdata.m_sceneID / 1000); if (sceneID != TaskQueryManager.ERRORID) { confScene = ConfScene.Get(sceneID); this.m_buildState = 2; } else { confScene = ConfScene.Get(this.m_enterdata.m_sceneID); this.m_buildState = 1; } } this.m_lockImg.Visible = (this.m_buildState == 0); m_difficultImg.Visible = !m_lockImg.Visible; int?difficult = FindObjSceneDataManager.Instance.GetDataBySceneID(this.m_enterdata.m_sceneID)?.m_lvl; m_difficultImg.Sprite = difficult > 0 ? ConfPoliceRankIcon.Get(difficult.Value).icon : ConfPoliceRankIcon.Get(1).icon; this.m_sceneTex.TextureName = confScene.thumbnail; this.m_sceneLab.Text = LocalizeModule.Instance.GetString(confScene.name); }
public void SetCameraParam(long sceneId) { this.m_dragDelta = 1f; this.m_pinInDelta = 1f; ConfScene confscene = ConfScene.Get(sceneId); string cameraParam = confscene.cameraParam.Trim(); if (confscene != null && !string.IsNullOrEmpty(cameraParam)) { string[] paramSplit = cameraParam.Split(','); if (paramSplit.Length >= 1) { m_dragDelta = float.Parse(paramSplit[0]); } if (paramSplit.Length >= 2) { m_pinInDelta = float.Parse(paramSplit[1]); } if (paramSplit.Length >= 3) { m_ZoomKick = float.Parse(paramSplit[2]); } } }
private void ShowAcceptTaskTips() { var taskTotalCompleteMode = TaskCompleteMode.NONE; foreach (var cc in m_taskInfo.CompleteConditionList) { TaskCompleteAttribute taskCompleteAttribute = cc.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; taskTotalCompleteMode |= taskCompleteAttribute.CompleteMode; } if (TaskCompleteMode.CompletedBySceneID == (taskTotalCompleteMode & TaskCompleteMode.CompletedBySceneID)) { //场景(寻物,拼图) TaskCompleteByScene collectDataInfo = m_taskInfo.CompleteConditionList[0] as TaskCompleteByScene; long scene_id = collectDataInfo.TaskCompleteData; if (CommonData.C_JIGSAW_SCENE_START_ID == scene_id / CommonData.C_SCENE_TYPE_ID) { //拼图 m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", CommonHelper.GetModeName(scene_id)); } else if (CommonData.C_SEEK_SCENE_START_ID == scene_id / CommonData.C_SCENE_TYPE_ID) { //寻物场景 string scene_name = LocalizeModule.Instance.GetString(ConfScene.Get(scene_id).name); m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips1", scene_name, CommonHelper.GetModeName(scene_id)); } } else if ((TaskCompleteMode.CompletedBySceneID | TaskCompleteMode.CompletedByItem) == (taskTotalCompleteMode & (TaskCompleteMode.CompletedBySceneID | TaskCompleteMode.CompletedByItem))) { //场景+寻物(必然是场景) foreach (var complete_condition in m_taskInfo.CompleteConditionList) { if (complete_condition.GetType() == typeof(TaskCompleteByScene)) { TaskCompleteByScene collectDataInfo = complete_condition as TaskCompleteByScene; long scene_id = collectDataInfo.TaskCompleteData; //寻物场景 string scene_name = LocalizeModule.Instance.GetString(ConfScene.Get(scene_id).name); m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips1", scene_name, CommonHelper.GetModeName(scene_id)); break; } } } else if (TaskCompleteMode.CompleteByScanID == (taskTotalCompleteMode & TaskCompleteMode.CompleteByScanID)) { //尸检 m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", LocalizeModule.Instance.GetString("tips_autopsy")); } else if (TaskCompleteMode.CompleteByReasonID == (taskTotalCompleteMode & TaskCompleteMode.CompleteByReasonID)) { //推理 m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", LocalizeModule.Instance.GetString("tips_detective")); } else if (TaskCompleteMode.CompleteByCombinePropID == (taskTotalCompleteMode & TaskCompleteMode.CompleteByCombinePropID)) { //合成 m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", LocalizeModule.Instance.GetString("tips_combine")); } else { this.m_tips_txt.Text = string.Empty; } }
void TaskCreateSceneByDifficult(long tsk_id_) { long scene_id = FindObjSceneDataManager.LoadSceneIDForTask(tsk_id_); if (scene_id < 0) { long scene_difficult_id = FindObjSceneDataManager.GetSceneDifficultID(m_scene_group_id, m_group_data.m_lvl); long[] sceneid4random = ConfSceneDifficulty.Get(scene_difficult_id).sceneIds; int[] weights4random = ConfSceneDifficulty.Get(scene_difficult_id).sceneWeights; FindObjSceneData my_difficult_data = FindObjSceneDataManager.Instance.GetDataBySceneGroupID(m_scene_group_id); int?my_difficult_lvl = my_difficult_data?.m_lvl; int?my_difficult_exp = my_difficult_data?.m_exp; if ((1 == my_difficult_lvl || 0 == my_difficult_lvl) && 0 == my_difficult_exp) { //首次使用普通玩法 scene_id = sceneid4random[0]; } else { //二次随机 List <RateScene> scenes4rdm = new List <RateScene>(); for (int i = 0; i < sceneid4random.Length; ++i) { RateScene rs = new RateScene() { SceneID = sceneid4random[i], Rate = weights4random[i], }; scenes4rdm.Add(rs); } int idx = randomGetIdex(scenes4rdm); if (idx >= 0) { RateScene selected_scene = scenes4rdm[idx]; scene_id = selected_scene.SceneID; FindObjSceneDataManager.SaveSceneIDForTask(tsk_id_, scene_id); if (1 == ConfTask.Get(tsk_id_).type) { //主线任务,影响bulid top的场景id FindObjSceneDataManager.SaveSceneIDForBuildTop(FindObjSceneDataManager.ConvertSceneIdToSceneGroupId(scene_id), scene_id); } } } } if (scene_id > 0) { this.m_scene_id = scene_id; m_s_info = ConfScene.Get(m_scene_id); m_time_cost_value = m_s_info.secondGain; m_vit_cost_value = m_s_info.vitConsume; } else { m_s_info = null; m_time_cost_value = 0; m_vit_cost_value = 0; } }
public override void OnShow(object param) { base.OnShow(param); GameEvents.UIEvents.UI_GameEntry_Event.OnMaskBGVisible.SafeInvoke(true); GameEvents.UIEvents.UI_GameEntry_Event.OnInfiniteVit += OnInfiniteVit; MessageHandler.RegisterMessageHandler(MessageDefine.SCSceneEnterResponse, OnScResponse); this.m_action_btn.AddClickCallBack(OnBtnStartGameClick); this.m_exp_reward_icon.AddPressDownCallBack(OnSceneGroupGiftPressDown); this.m_exp_reward_icon.AddPressUpCallBack(OnSceneGroupGiftPressUp); EnterSceneData enterSceneData = null; m_scene_id = -1; m_scene_group_id = -1; m_enter_msg = null; if (null != param) { enterSceneData = param as EnterSceneData; //this.m_scene_id = (int)enterSceneData.SceneID; this.m_taskConfID = enterSceneData.taskConfID; } if (-1 == m_taskConfID) { //不是从任务展示界面来的,不用翻转 BgShowAlpha(false); PanelDelayShowAlpha(0.0f); PanelDelayShowScale(0.0f); PanelTurnToOne(false); PanelGoDown(true); } else { //需要翻转 BgShowAlpha(true); PanelDelayShowAlpha(0.2f); PanelDelayShowScale(0.5f); PanelGoDown(false); PanelTurnToZero(false); PanelTurnToOne(true); } ConfTask task = null; if (this.m_taskConfID < 0) { //build top 进入 this.m_scene_group_id = FindObjSceneDataManager.ConvertSceneIdToSceneGroupId(enterSceneData.SceneID); m_group_data = new FindObjSceneData(this.m_scene_group_id, 1, 0); BuildTopCreateSceneByDifficult(this.m_scene_group_id); } else { task = ConfTask.Get(m_taskConfID); long tsk_scene_id = null != task ? task.conditionSceneId : enterSceneData.SceneID; m_special_scene_id = 0; //初始化一个默认的group data; m_group_data = new FindObjSceneData(FindObjSceneDataManager.ConvertSceneIdToSceneGroupId(tsk_scene_id), 1, 0); this.m_scene_group_id = FindObjSceneDataManager.ConvertSceneIdToSceneGroupId(tsk_scene_id); var temp_data = FindObjSceneDataManager.Instance.GetDataBySceneGroupID(m_scene_group_id); if (null != temp_data) { m_group_data = temp_data; } if (tsk_scene_id > 99999) { //配置的场景id if (1 == ConfScene.Get(tsk_scene_id).keyExhibit) { //关键证据关卡 CreateSceneBySpecial(tsk_scene_id); } else { //非关键关卡 //读取难度表 TaskCreateSceneByDifficult(this.m_taskConfID); } } else { //配置的场景组id,一定是非关键线索关卡 TaskCreateSceneByDifficult(this.m_taskConfID); } } m_play_mode_img.Sprite = this.GetModeIconName(m_scene_id); m_scene_tex.TextureName = m_s_info.thumbnail; m_scene_name_label.Text = LocalizeModule.Instance.GetString(m_s_info.name); this.ShowOutPut(m_s_info.outputExp, m_s_info.outputMoney, m_s_info.outputCash, m_s_info.outputVit); List <long> ids = CommonHelper.GetDropOuts(m_s_info.dropId); var props = from id in ids select new DropWrapper() { DropType = ENUM_DROP_TYPE.PROP, ItemID = id, ItemNum = 0, Icon = ConfProp.Get(id).icon, }; List <DropWrapper> totalToShow = new List <DropWrapper>(); if (null != task && task.conditionExhibits.Length > 0) { var exhibits = from id in task.conditionExhibits select new DropWrapper() { DropType = ENUM_DROP_TYPE.EXHABIT, ItemID = id, ItemNum = 0, Icon = Confexhibit.Get(id).iconName, }; totalToShow.AddRange(exhibits); } //DropWrapper te = new DropWrapper() //{ // DropType = ENUM_DROP_TYPE.EXHABIT, // ItemID = 10972, // ItemNum = 0, // Icon = Confexhibit.Get(10972).iconName, //}; //totalToShow.Add(te); totalToShow.AddRange(props); m_drop_grid.EnsureSize <DropItemIconEffect>(totalToShow.Count); for (int i = 0; i < m_drop_grid.ChildCount; ++i) { var show = totalToShow[i]; DropItemIconEffect di = m_drop_grid.GetChild <DropItemIconEffect>(i); m_drop_grid.GetChild <DropItemIconEffect>(i).InitSprite(show.Icon, show.ItemNum, show.ItemID, ENUM_DROP_TYPE.EXHABIT == show.DropType); if (ENUM_DROP_TYPE.PROP == show.DropType) { m_drop_grid.GetChild <DropItemIconEffect>(i).EnableTips(true); m_drop_grid.GetChild <DropItemIconEffect>(i).InitToolTipOffset(new Vector2(-280.0f, 0.0f)); } else { m_drop_grid.GetChild <DropItemIconEffect>(i).EnableTips(false); } m_drop_grid.GetChild <DropItemIconEffect>(i).Visible = true; } m_drop_grid.Visible = false; long scene_difficult_id = FindObjSceneDataManager.GetSceneDifficultID(m_scene_group_id, m_group_data.m_lvl); ConfSceneDifficulty difficult_data = ConfSceneDifficulty.Get(scene_difficult_id); m_gifts = new List <GroupToolTipsData>(); for (int i = 0; i < difficult_data.rewards.Length; ++i) { GroupToolTipsData reward = new GroupToolTipsData() { ItemID = difficult_data.rewards[i], CurCount = difficult_data.rewardNums[i], }; m_gifts.Add(reward); } m_difficult_icon.Sprite = ConfPoliceRankIcon.Get(m_group_data.m_lvl).icon; m_difficlut_step.Text = LocalizeModule.Instance.GetString(difficult_data.name); m_exp_progress.Value = (float)m_group_data.m_exp / (float)m_group_data.m_full_exp; m_exp_txt.Text = $"{m_group_data.m_exp}/{m_group_data.m_full_exp}"; Debug.Log($"关卡进入 关卡组id{m_group_data.m_scene_group_id}"); m_cost_time_num_label.Text = CommonTools.SecondToStringMMSS(this.m_time_cost_value); SetVitLabel(); m_is_action_btn_touched = false; this.m_action_btn.Enable = true; Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>() { { UBSParamKeyName.Success, 1 }, { UBSParamKeyName.SceneID, this.m_scene_id }, }; UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_start, null, _params); }
public static string GetModeIconName(long scene_id) { string prefix = "icon_playmode"; if (scene_id < 20000000) { int play_mode = ConfScene.Get(scene_id).playMode; int wan, qian, bai; GetPlayMode(play_mode, out wan, out qian, out bai); string wan_str = string.Empty; if (0 == wan) { wan_str = "pt"; } else if (1 == wan) { wan_str = "miwu"; } else if (2 == wan) { wan_str = "hei"; } string qian_str = string.Empty; if (1 == qian) { qian_str = "pt"; } if (2 == qian) { qian_str = "fan"; } else if (3 == qian) { qian_str = "jian"; } string bai_str = string.Empty; if (0 == bai) { bai_str = "pt"; } if (1 == bai) { bai_str = "duo"; } return(string.Format("{0}_{1}_{2}_{3}.png", prefix, wan_str, qian_str, bai_str)); } else { prefix = "icon_playmode_jigsaw"; return(LocalizeModule.Instance.GetString("icon_playmode_jigsaw")); } }
public static string GetModeName(long scene_id) { string suffix = LocalizeModule.Instance.GetString("scene_mode"); if (scene_id < 20000000) { int play_mode = ConfScene.Get(scene_id).playMode; int wan, qian, bai; GetPlayMode(play_mode, out wan, out qian, out bai); string wan_str = string.Empty; if (0 == wan) { wan_str = LocalizeModule.Instance.GetString("scene_mode_1000");// "pt"; } else if (1 == wan) { wan_str = LocalizeModule.Instance.GetString("scene_mode_11000");//"miwu"; } else if (2 == wan) { wan_str = LocalizeModule.Instance.GetString("scene_mode_21000");//"hei"; } string qian_str = string.Empty; if (0 != wan) { if (1 == qian) { qian_str = string.Empty; //LocalizeModule.Instance.GetString("scene_mode_1000");//"pt"; } if (2 == qian) { qian_str = LocalizeModule.Instance.GetString("scene_mode_2000");//"fan"; } else if (3 == qian) { qian_str = LocalizeModule.Instance.GetString("scene_mode_3000");//"jian"; } } string bai_str = string.Empty; if (0 != wan) { if (0 == bai) { bai_str = string.Empty; //LocalizeModule.Instance.GetString("scene_mode_1000");//"pt"; } if (1 == bai) { bai_str = LocalizeModule.Instance.GetString("scene_mode_100");//"duo"; } } return(string.Format("{0}{1}{2}{3}", wan_str, qian_str, bai_str, suffix)); } else { return(LocalizeModule.Instance.GetString("UI.jigsaw")); } }
public static void Register() { ConfAchievement.Init(); ConfActiveDrop.Init(); ConfActivityBase.Init(); ConfAssetManifest.Init(); Confbranchtask.Init(); ConfBuilding.Init(); ConfCartoonScene.Init(); ConfChapter.Init(); ConfCharge.Init(); ConfChat.Init(); ConfChatItem.Init(); ConfCheckIn.Init(); ConfCombineFormula.Init(); ConfDemoScene.Init(); ConfDropOut.Init(); ConfPropGiftItem0.Init(); ConfPropGiftItem1.Init(); ConfPropGiftItem2.Init(); ConfDropOut2.Init(); Confetl.Init(); ConfEvent.Init(); ConfEventAttribute.Init(); ConfEventPhase.Init(); Confexhibit.Init(); ConfExpToLevel.Init(); Conffailtips.Init(); ConfFeedback.Init(); ConfFind.Init(); ConfFindClue.Init(); ConfFindTypeIcon.Init(); ConfGMCMD.Init(); ConfGuid.Init(); ConfGuidArt.Init(); ConfGuidNew.Init(); ConfGuidNewFunction.Init(); Confinapppurchase.Init(); ConfJigsawScene.Init(); ConfKeyWords.Init(); ConfLanguage.Init(); ConfMsgCode.Init(); ConfNode.Init(); ConfNpc.Init(); ConfOfficer.Init(); ConfPath.Init(); ConfPoliceRankIcon.Init(); ConfProp.Init(); ConfPropGift.Init(); ConfPropGiftItem0.Init(); ConfPropGiftItem1.Init(); ConfPropGiftItem2.Init(); ConfPush.Init(); ConfReasoning.Init(); ConfScene.Init(); ConfSceneDifficulty.Init(); ConfSceneSpecial.Init(); ConfServiceConfig.Init(); ConfSkill.Init(); ConfSkyEye.Init(); ConfSound.Init(); ConfTask.Init(); ConfTitle.Init(); }