private static ConfEventPhase GetConfByDic(DataTable reader)
        {
            long   id              = reader.GetInt64(0);
            string normalDialogue  = reader.GetString(1);
            string successDialogue = reader.GetString(2);
            string normaFeedback   = reader.GetString(3);
            string successFeedback = reader.GetString(4);
            string descs           = reader.GetString(5);
            int    normalBuff      = reader.GetInt32(6);
            int    perfectBuff     = reader.GetInt32(7);

            int[]  keyWords = (int[])reader.GetArrayData(8, 11);
            string name     = reader.GetString(9);

            ConfEventPhase new_obj_ConfEventPhase = new ConfEventPhase(id,
                                                                       normalDialogue,
                                                                       successDialogue,
                                                                       normaFeedback,
                                                                       successFeedback,
                                                                       descs,
                                                                       normalBuff,
                                                                       perfectBuff,
                                                                       keyWords,
                                                                       name
                                                                       );

            return(new_obj_ConfEventPhase);
        }
        public static bool GetConfig(string fieldName, object fieldValue, out ConfEventPhase config)
        {
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_EventPhase", 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("EventPhase 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex));
                }
                config = null;
                return(false);
            }
            config = null;
            return(false);
        }
Beispiel #3
0
        public static Dictionary <int, string> GetPhaseKeyWords(ConfEventPhase phase_data_)
        {
            Dictionary <int, string> ret = new Dictionary <int, string>();

            for (int i = 0; i < phase_data_.keyWords.Length; i++)
            {
                int    key_word_id = phase_data_.keyWords[i];//int.Parse(key_str);
                string key_word    = LocalizeModule.Instance.GetString(ConfKeyWords.Get(key_word_id).word);
                ret.Add(key_word_id, key_word);
            }

            return(ret);
        }
        public void Refresh(int total_officer_count_)
        {
#if OFFICER_SYS
            m_officers_grid.EnsureSize <EventGameOfficerDispatchItemView>(total_officer_count_);

            for (int i = 0; i < m_officers_grid.ChildCount; ++i)
            {
                m_officers_grid.GetChild <EventGameOfficerDispatchItemView>(i).Init(i);
                m_officers_grid.GetChild <EventGameOfficerDispatchItemView>(i).Visible = true;
            }
#endif

            ConfEvent event_data = ConfEvent.Get(CurViewLogic().Event_id);

            m_vit_cost_num_txt.Text = event_data.vitConsume.ToString();

            HashSet <long> keywords = new HashSet <long>();

            foreach (var phase_id in event_data.phases)
            {
                var phase = ConfEventPhase.Get(phase_id);

                foreach (var key_id in phase.keyWords)
                {
                    keywords.Add(key_id);
                }
            }

            m_keywords_grid.EnsureSize <EventGameKeywordItemView>(keywords.Count);

            int gi = 0;
            foreach (var item in keywords)
            {
                m_keywords_grid.GetChild <EventGameKeywordItemView>(gi).Refresh(gi, item);
                m_keywords_grid.GetChild <EventGameKeywordItemView>(gi).Visible = true;
                ++gi;
            }

            m_event_icon.Sprite    = ConfEventAttribute.Get(event_data.type).icon;
            m_event_name.Text      = LocalizeModule.Instance.GetString(event_data.name);
            m_event_desc.Text      = LocalizeModule.Instance.GetString(event_data.descs);
            m_case_name.Text       = LocalizeModule.Instance.GetString(ConfEventAttribute.Get(event_data.type).name);
            m_case_tex.TextureName = event_data.sceneInfo;


            m_normal_cash_txt.Text  = event_data.coinGain.ToString();
            m_perfect_cash_txt.Text = event_data.cashGain.ToString();
        }
 private static void GetArrrayList()
 {
     if (cacheArray.Count <= 0)
     {
         DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_EventPhase");
         if (sqReader != null)
         {
             while (sqReader.Read())
             {
                 ConfEventPhase _conf = GetConfByDic(sqReader);
                 cacheArray.Add(_conf);
                 dic[_conf.id] = _conf;
             }
             resLoaded = true;
         }
     }
 }
Beispiel #6
0
        public static void GetFeedBackAndDialogue(long officer_id_, long phase_id_, int valuation_, out string feedback_, out string dialogue_)
        {
            officer_id_ = 0 == officer_id_ ? 101 : officer_id_;
            string temp_feedback = 0 == valuation_?ConfEventPhase.Get(phase_id_).normaFeedback : ConfEventPhase.Get(phase_id_).successFeedback;

            string temp_dialogue = 0 == valuation_?ConfEventPhase.Get(phase_id_).normalDialogue : ConfEventPhase.Get(phase_id_).successDialogue;

            string officer_name = LocalizeModule.Instance.GetString(ConfOfficer.Get(officer_id_).name);

            feedback_ = LocalizeModule.Instance.GetString(temp_feedback);

            feedback_ = ExchangeKeyWords(feedback_, officer_name);

            dialogue_ = LocalizeModule.Instance.GetString(temp_dialogue);

            dialogue_ = ExchangeKeyWords(dialogue_, officer_name);
        }
        public static bool GetConfig(long id, out ConfEventPhase config)
        {
            if (dic.TryGetValue(id, out config))
            {
                return(config != null);
            }
            if (cacheLoaded)
            {
                config = null;
                return(false);
            }
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_EventPhase", 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("EventPhase 表找不到SN={0} 的数据\n{1}", id, ex));
                }
                config = null;
                return(false);
            }
            else
            {
                config = null;
                return(false);
            }
        }
        private void NextStep()
        {
            if (false == this.Visible)
            {
                return;
            }

            PhaseInfo info_ = m_phases.Dequeue();

            if (null == info_)
            {
                this.GetReward();
                return;
            }

            Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
            {
                { UBSParamKeyName.Success, info_.Perfect ? 1 : 0 },
                { UBSParamKeyName.ContentID, CurViewLogic().Event_id },
                { UBSParamKeyName.PhaseID, info_.PhaseTemplateId },
                { UBSParamKeyName.OfficerID, info_.OfficerTemplateId }
            };

            UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.event_Phase, null, _params);

            m_desc_root.Visible = false;

            m_case_txt.Text = LocalizeModule.Instance.GetString(ConfEventPhase.Get(info_.PhaseTemplateId).descs);

            Action OnCase = () => PlayCase(info_.PhaseTemplateId);
            Action OnTalk = () =>
            {
                PlayTalk(info_.OfficerTemplateId, info_.PhaseTemplateId, false == info_.Perfect ? 0 : 1);
                AddScore(m_cur_score, m_cur_score - info_.PhaseScore);
            };

            Action OnEndPhase = () =>
            {
                m_case_root.Visible = false;
            };

            Action OnNext = () =>
            {
                //if (0 != m_phases.Count)
                //    TimeModule.Instance.SetTimeout(NextStep, C_TWEEN_TIME + 0.5f);
                //else
                //    TimeModule.Instance.SetTimeout(GetReward, C_TWEEN_TIME + 0.5f);

                if (0 != m_phases.Count)
                {
                    NextStep();
                }
                else
                {
                    GetReward();
                }
            };

            TimeModule.Instance.SetTimeout(OnCase, C_TWEEN_TIME);
            TimeModule.Instance.SetTimeout(OnTalk, C_TWEEN_TIME + 0.5f);
            TimeModule.Instance.SetTimeout(OnEndPhase, C_TWEEN_TIME + 2.5f);
            TimeModule.Instance.SetTimeout(OnNext, C_TWEEN_TIME + 3.5f);
        }
Beispiel #9
0
 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();
 }