Esempio n. 1
0
        protected void InitGuideState()
        {
            ////////////////////////////////////////////////////////初始化引导状态行为树
            m_GuideStateRoot = new GuideState_Root();
            for (int i = 0; i < dicGuideStateConfigTable.Count; ++i)
            {
                SSchemeGuideStateData data = dicGuideStateConfigTable[i];
                if (data != null && data.GuideNodeIDList != null && data.GuideNodeIDList.Count > 0)
                {
                    GuideState_GameState_Selector gameStateSelector = null;
                    //判断已经有该状态类型
                    if (!m_GuideStateRoot.TryGetGameStateSelector(data.GameStateID, out gameStateSelector))
                    {//没有则增加
                        gameStateSelector = new GuideState_GameState_Selector(data.GameStateID);
                        m_GuideStateRoot.AddChild(gameStateSelector);
                    }

                    //判断是否已有该用户ID
                    GuideState_UserID_Selector userIDSelector = null;
                    if (!gameStateSelector.TryGetUserIDSelector(data.UserIDType, data.UserID, out userIDSelector))
                    {
                        userIDSelector = new GuideState_UserID_Selector(data.UserIDType, data.UserID);
                        gameStateSelector.AddChild(userIDSelector);
                    }

                    //挂接创建动态引导根节点逻辑
                    if (userIDSelector != null)
                    {
                        GuideState_CreateDynamicGuideLeaf dynamic = new GuideState_CreateDynamicGuideLeaf(data.GuideStateID);
                        dynamic.SetPrecondition(new TBTPreconditionAND(new CON_IsMainPlayerCreated(), new CON_IsPlayerLevelExit(data.PlayerLevelLimit)));
                        userIDSelector.AddChild(dynamic);
                    }
                }
            }

            m_guideData = new GuideWorkingData();
            m_guideData.GuideDynamicBB = new GuideBlackboard_EGuideBBKey();
            m_guideData.GuideStateBB   = new GuideBlackboard_EGuideStateBBKey();
            m_guideData.GuideStateBB.SetValue(EGuideStateBBKey.PlayerNoviceGuideType, ENNOVICEGUIDE_TYPE.ENNOVICEGUIDE_TYPE_GUIDE_TWOSTEP);
        }
Esempio n. 2
0
        public void CreateNewDynamicGuideRoot(TBTWorkingData wData)
        {
            if (m_GuideDynamicRoot == null)
            {
                GuideWorkingData data = wData as GuideWorkingData;
                if (data != null && data.GuideDynamicBB != null)
                {
                    int GuideStateID = data.GuideStateBB.GetValue <int>(EGuideStateBBKey.GuideStateID, -1);
                    SSchemeGuideStateData stateData = GetGuideStateData(GuideStateID);
                    if (stateData != null)
                    {
                        m_GuideDynamicRoot = CreateDynamicRoot(stateData.GuideRootType);


                        for (int j = 0; j < stateData.GuideNodeIDList.Count; ++j)
                        {
                            EGuideNodeID         guideNodeID   = (EGuideNodeID)stateData.GuideNodeIDList[j];
                            SSchemeGuideNodeData guideNodeData = null;
                            if (dicGuideConfigTable.TryGetValue(guideNodeID, out guideNodeData))
                            {
                                //先根据引导节点需要挂接的父节点类型处理
                                EGuideActionLayerType layerType       = (EGuideActionLayerType)guideNodeData.nGuideActionLayerType;
                                TBTAction             layerTypeAction = null;
                                if (!m_GuideDynamicRoot.TryGetLayerTypeAction(layerType, out layerTypeAction))
                                {
                                    layerTypeAction = CreateLayerTypeAction(layerType);
                                    m_GuideDynamicRoot.AddChild(layerTypeAction);
                                }

                                layerTypeAction.AddChild(getNodeDataInstance(guideNodeID));
                            }
                            else
                            {
                                Trace.LogWarning("没有引导ID为:" + guideNodeID + " 的引导数据,配错了?");
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        protected void _LoadGuideStateConfig(string _strPath)
        {
            dicGuideStateConfigTable = new List <SSchemeGuideStateData>();

            ScpReader reader = new ScpReader(_strPath, true);

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeGuideStateData sConfig = new SSchemeGuideStateData();

                sConfig.GuideStateID     = reader.GetInt(i, (int)EGuideStateData.EGSD_GuideStateID, -1);
                sConfig.GameStateID      = (EStage_State)reader.GetInt(i, (int)EGuideStateData.EGSD_GameState, 0);
                sConfig.UserIDType       = (EGuideStateUserIDType)reader.GetInt(i, (int)EGuideStateData.EGSD_UserIDType, 0);
                sConfig.UserID           = reader.GetInt(i, (int)EGuideStateData.EGSD_UserID, -1);
                sConfig.GuideRootType    = (EGuideActionLayerType)reader.GetInt(i, (int)EGuideStateData.EGSD_GuideRootType, -1);
                sConfig.GuideNodeIDList  = ScpReader.ConvertStringToIntArray(reader.GetString(i, (int)EGuideStateData.EGSD_GuideNodeIDList, ""), new char[] { ';' });
                sConfig.PlayerLevelLimit = reader.GetInt(i, (int)EGuideStateData.EGSD_PlayerLevelLimit, -1);

                dicGuideStateConfigTable.Add(sConfig);
            }
            reader.Dispose();
            reader = null;
        }