Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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;
            }
        }