コード例 #1
0
        /// <summary>
        /// 创建当前玩家英雄后设置
        /// </summary>
        /// <param name="_heroID">当前英雄ID</param>
        private void SetCurrentHeroRecommendGoods(CreateMainHeroEntityEventArgs e)
        {
            if (MobaRecommendGoodsReader == null)
            {
                return;
            }

            int SchemesHeroID = 0;

            for (int i = 0; i < MobaRecommendGoodsReader.GetRecordCount(); i++)
            {
                // 判断英雄ID
                SchemesHeroID = MobaRecommendGoodsReader.GetInt(i, (int)EMobaRecommendGoods.EMRG_HeroID, 0);
                if (SchemesHeroID == e.MainHeroID)
                {
                    // 判断比赛类型
                    string     strMatchType  = MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_MatchTypes, "");
                    char[]     charSeparator = new char[] { MobaSchemesConfig.separator };
                    List <int> intArray      = ScpReader.ConvertStringToIntArray(strMatchType, charSeparator);
                    if (!intArray.Contains((int)e.nMatchTypeID))
                    {
                        continue;
                    }

                    // 获取装备配置
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_EerlyList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_EerlyStage, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_MiddleList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_MiddleStage, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_DownWindList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_DownWindStage, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_UpWindList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_UpWindStage, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_ConsumeGoodsList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_ConsumeGoods, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_DefaultGoodsTypeList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_DefaultTypes, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_UsedStageList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_UsedStage, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_DispositionStageList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_DispositionStage, "0"));

                    CurrentHeroRecommendGoods.RecommendGoods_SummerID = MobaRecommendGoodsReader.GetInt(i, (int)EMobaRecommendGoods.EMRG_SummerID, 0);
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_SummerEerlyList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_SummerEerlyStage, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_SummerMiddleList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_SummerMiddleStage, "0"));
                    SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_SummerDownWindList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_SummerDownWindStage, "0"));
                }
            }
            MobaRecommendGoodsReader.Dispose();
            MobaRecommendGoodsReader = null;

            EntityFactory.CreateMainHeroEntityEvent -= SetCurrentHeroRecommendGoods;

            if (MobaGoodsSchemesInitEndEvent != null)
            {
                MobaGoodsSchemesEventArgs a = new MobaGoodsSchemesEventArgs();
                a.RecommendGoods        = CurrentHeroRecommendGoods;
                a.LabelDescirptionTable = labelDescirptionTable;
                MobaGoodsSchemesInitEndEvent(a);
            }
        }
コード例 #2
0
        private void InitWarBgmConfigCsv(string path)
        {
            ScpReader reader = new ScpReader(path, true, 2);

            warBgmConfigDic = new Dictionary <int, List <SSchemeWarBgmConfig> >();
            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                int nCol     = 0;
                int configID = reader.GetInt(i, nCol++, 0);
                SSchemeWarBgmConfig sConfig = new SSchemeWarBgmConfig();
                sConfig.soundID      = reader.GetInt(i, nCol++, 0);
                sConfig.playCount    = reader.GetInt(i, nCol++, 0);
                sConfig.playDelay    = reader.GetFloat(i, nCol++, 0);
                sConfig.playInterval = reader.GetFloat(i, nCol++, 0);
                List <SSchemeWarBgmConfig> warBgmList;
                if (!warBgmConfigDic.TryGetValue(configID, out warBgmList))
                {
                    warBgmList = new List <SSchemeWarBgmConfig>();
                    warBgmConfigDic.Add(configID, warBgmList);
                }
                warBgmConfigDic[configID].Add(sConfig);
            }
            reader.Dispose();
            reader = null;
        }
コード例 #3
0
        private void InitChatEmoticonConfigCsv(string strPath)
        {
            ScpReader reader = new ScpReader(strPath, true, 2);

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeChatEmoticonData sConfig = new SSchemeChatEmoticonData();
                sConfig.nEmoticonID       = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_ID, 0);
                sConfig.nEmoticonSerialID = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_Serial, 0);
                sConfig.eEmoticonType     = (EMChatEmoticonType)Enum.Parse(typeof(EMChatEmoticonType), reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_Type, ""));
                sConfig.szEmoticonKey     = reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_Key, string.Empty);
                sConfig.szCharInput       = reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_CharInput, string.Empty);
                sConfig.szTipDesc         = reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_TipDesc, string.Empty);
                sConfig.nEmoticonSellID   = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_SellID, 0);
                sConfig.nEmoticonSkillID  = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_skillID, 0);

                if (m_dicChatEmoticonConfig.ContainsKey(sConfig.nEmoticonID))
                {
                    Trace.LogWarning("有相同的聊天表情ID" + sConfig.nEmoticonID + "表第" + i + "行");
                }
                else
                {
                    m_dicChatEmoticonConfig.Add(sConfig.nEmoticonID, sConfig);
                }

                if (!m_chatEmoticonSerialList.ContainsKey(sConfig.nEmoticonSerialID))
                {
                    m_chatEmoticonSerialList.Add(sConfig.nEmoticonSerialID, new List <SSchemeChatEmoticonData>());
                }
                m_chatEmoticonSerialList[sConfig.nEmoticonSerialID].Add(sConfig);
            }
            reader.Dispose();
            reader = null;
        }
コード例 #4
0
    public static void ReadCSVFile(string filename, string tag, bool headerRow, DataTable datatable)
    {
        ScpReader reader = new ScpReader(filename, tag);

        reader.CreateDataTable(headerRow, datatable);
        reader.Dispose();
    }
コード例 #5
0
        public void Load(string _strPath)
        {
            m_dicGoodsSchemeTable = new Dictionary <int, SSchemeMobaGoods>();

            ScpReader MobaGoodsReader = new ScpReader(_strPath, true, 2);//new ScpReader(SchemeAllText, "MobaGoods", 2);

            for (int i = 0; i < MobaGoodsReader.GetRecordCount(); i++)
            {
                SSchemeMobaGoods goods = new SSchemeMobaGoods();
                goods.GoodsID                   = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_ID, 0);
                goods.GoodsName                 = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Name, string.Empty);
                goods.GoodsIconID               = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_IconID, 0);
                goods.GoodsCost                 = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_Cost, 0);
                goods.GoodsSoldOutCost          = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_SoldOutCost, 0);
                goods.GoodsDes                  = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Description, string.Empty);
                goods.GoodsCanComposeList       = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_CanComposeList, string.Empty);
                goods.GoodsNeedComposeList      = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_NeedComposeList, string.Empty);
                goods.GoodsLabel                = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Label, string.Empty);
                goods.GoodsWarLimit             = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_WarLimit, string.Empty);
                goods.GoodsSlotDes              = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_SlotDescription, string.Empty);
                goods.GoodsVocationLimit        = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_VocationTypeLimit, 0);
                goods.GoodsPreciousDegree       = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_PreciousDegree, 0);
                goods.GoodsFlag                 = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_Flag, 0);
                goods.GoodsLocationInstructions = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_LocationInstructions, string.Empty);

                m_dicGoodsSchemeTable.Add(goods.GoodsID, goods);
            }
            // 需要加一列空值(服务端传过来时会传过来一个0  在这个容器里查找 如果不加会报错)
            if (m_dicGoodsSchemeTable.ContainsKey(0) == false)
            {
                m_dicGoodsSchemeTable.Add(0, new SSchemeMobaGoods());
            }

            MobaGoodsReader.Dispose();
        }
コード例 #6
0
        /// <summary>
        /// 初始化技能提示
        /// </summary>
        /// <param name="strDefaultViewConfigPath"></param>
        private void InitAboutShowSpellPromptScheme(string strDefaultViewConfigPath)
        {
            string strLabelDescriptionPath = strDefaultViewConfigPath + MobaSchemesConfig.SHOW_SPELL_PROMPT;


            ScpReader ShowSpellPromptReader = new ScpReader(strLabelDescriptionPath, true, 2);

            ShowSpellPromptTable = new Hashtable();
            for (int i = 0; i < ShowSpellPromptReader.GetRecordCount(); i++)
            {
                SSchemeShowSpellPrompt data = new SSchemeShowSpellPrompt();
                data.nID = ShowSpellPromptReader.GetInt(i, (int)EShowSpellPrompt.ESSP_ID, -1);
                if (data.nID == -1)
                {
                    break;
                }
                data.nSpellID = ShowSpellPromptReader.GetInt(i, (int)EShowSpellPrompt.ESSP_SpellID, 0);
                data.nSlotID  = ShowSpellPromptReader.GetInt(i, (int)EShowSpellPrompt.ESSP_SlotID, 0);


                ShowSpellPromptTable.Add(data.nID, data);
            }

            ShowSpellPromptReader.Dispose();
        }
コード例 #7
0
ファイル: SceneEffectNodeData.cs プロジェクト: zwong91/Titan
        public void Load(string strPath)
        {
            m_dicSchemeSceneEffectNodeData = new Dictionary <int, SSchemeSceneEffectNodeData>();

            ScpReader reader = new ScpReader(strPath, true, 1);

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeSceneEffectNodeData sConfig = new SSchemeSceneEffectNodeData();
                sConfig.eSceneEffectID       = reader.GetInt(i, (int)ESceneEffectNodeConfig.SEN_ID, 0);
                sConfig.nSceneEffectDuration = reader.GetInt(i, (int)ESceneEffectNodeConfig.SEN_Duration, 0);
                sConfig.strSceneEffectPath   = reader.GetString(i, (int)ESceneEffectNodeConfig.SEN_Path, string.Empty);

                if (m_dicSchemeSceneEffectNodeData.ContainsKey(sConfig.eSceneEffectID))
                {
                    Trace.LogWarning("有相同的场景特效ID" + sConfig.eSceneEffectID + "表第" + i + "行");
                }
                else
                {
                    m_dicSchemeSceneEffectNodeData.Add(sConfig.eSceneEffectID, sConfig);
                }
            }
            reader.Dispose();
            reader = null;
        }
コード例 #8
0
        public void Load(string strPath)
        {
            m_personModelConfigs = new List <SSchemePersonModelData>();

            ScpReader reader = new ScpReader(strPath, true, 2);

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemePersonModelData data = new SSchemePersonModelData();
                data.nHeroID        = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROID, 0);
                data.nHeroType      = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROTYPE, 0);
                data.nOperationType = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_OPERATIONTYPE, 0);
                data.nHeroCharacter = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROCHARACTER, 0);
                data.nSex           = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_SEX, 0);
                data.nDefaultSkinID = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_DEFAULTSKINID, 0);
                data.szHeroName     = reader.GetString(i, (int)EMPersonModelConfig.EMPMC_HERONAME, "");
                data.szHeroTitle    = reader.GetString(i, (int)EMPersonModelConfig.EMPMC_HEROTITLE, "");
                data.nMiniMapIcon   = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_MINIMAPICON, 0);
                data.nViewDistance  = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_VIEWDISTANCE, 0);
                data.nHeroSwitch    = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROSWITCH, 0);
                data.szTotalSkinID  = reader.GetString(i, (int)EMPersonModelConfig.EMPMC_TOTALSKINID, "");
                data.nHeroUnLockLv  = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROUNLOCKLV, 0);
                m_personModelConfigs.Add(data);
            }
            reader.Dispose();
            reader = null;
        }
コード例 #9
0
ファイル: ResourceEx.cs プロジェクト: zwong91/Titan
    public static void LoadResourceTable(string path)
    {
        resourcetable.Clear();
        ScpReader reader = new ScpReader(path, true);

        for (int i = 0; i < reader.GetRecordCount(); i++)
        {
            ResourceInfoEx currentinfo = new ResourceInfoEx();
            currentinfo.bundlename    = reader.GetString(i, 2, "");
            currentinfo.assetfilename = reader.GetString(i, 3, "");
            currentinfo.objectname    = reader.GetString(i, 1, "");
            currentinfo.classname     = reader.GetString(i, 0, "");
            currentinfo.typename      = reader.GetString(i, 4, "");
            currentinfo.path          = reader.GetString(i, 5, "");
            currentinfo.offset        = reader.GetLong(i, 6, -1);
            currentinfo.length        = reader.GetLong(i, 7, -1);
            if (resourcetable.ContainsKey(currentinfo.classname) == false)
            {
                resourcetable[currentinfo.classname] = new Dictionary <string, ResourceInfoEx>();
            }
            Dictionary <string, ResourceInfoEx> resourcelist = resourcetable[currentinfo.classname];
            resourcelist[currentinfo.objectname] = currentinfo;
        }

        reader.Dispose();

        Trace.Log("ResourceEx::LoadResourceTable:" + path + " finish");
    }
コード例 #10
0
ファイル: SoundManager_Data.cs プロジェクト: zwong91/Titan
    /// <summary>
    /// 加载声音配置
    /// </summary>
    private static bool LoadSoundConfig(ref Dictionary <int, SoundConfigData> dataSet)
    {
        if (dataSet == null)
        {
            SoundSystemLog("参数dataset为null");
            return(false);
        }

        string patch = ViewConfigManager.GetConfigFullPath(ConfigFileName);

        ScpReader SoundReader = new ScpReader(patch, true, 2);

        // 遍歷整個表并存儲起來
        for (int i = 0; i < SoundReader.GetRecordCount(); ++i)
        {
            SoundConfigData data = new SoundConfigData();
            data.nID                       = SoundReader.GetInt(i, (int)SoundConfigCol.COL_ID, 0);
            data.soundType                 = (EMSoundType)SoundReader.GetInt(i, (int)SoundConfigCol.COL_Type, 2);
            data.mixerGroupType            = (AudioMixerGroupType)SoundReader.GetInt(i, (int)SoundConfigCol.COL_MixerGroupType, 1);
            data.nMixerGroupIndex          = SoundReader.GetInt(i, (int)SoundConfigCol.COL_MixerGroupIndex, 0);
            data.bBypassEffect             = SoundReader.GetInt(i, (int)SoundConfigCol.COL_BypassEffect, 0) > 0;
            data.bBypassReverbZone         = SoundReader.GetInt(i, (int)SoundConfigCol.COL_BypassReverbZone, 0) > 0;
            data.bPlayOnAwake              = SoundReader.GetInt(i, (int)SoundConfigCol.COL_PlayOnAwake, 1) > 0;
            data.nPriority                 = Mathf.Clamp(SoundReader.GetInt(i, (int)SoundConfigCol.COL_Priority, 128), 0, 256);
            data.fPitch                    = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_Pitch, 1), -3.0f, 3.0f);
            data.fStereoPan                = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_StereoPan, 0), -1.0f, 1.0f);
            data.fReverZoneMix             = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_ReverZoneMix, 1), 0, 1.1f);
            data.b3DSound                  = SoundReader.GetInt(i, (int)SoundConfigCol.COL_3DSound, 1) > 0;
            data.fDopplerLv                = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_DopplerLv, 1), 0, 5.0f);
            data.nSpread                   = Mathf.Clamp(SoundReader.GetInt(i, (int)SoundConfigCol.COL_Spread, 0), 0, 360);;
            data.audioRoffType             = (AudioRolloffMode)SoundReader.GetInt(i, (int)SoundConfigCol.COL_RolloffMode, 0);
            data.fMinDistance              = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_MinDistance, 1);
            data.fMaxDistance              = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_MaxDistance, 15);
            data.nPlayTimes                = SoundReader.GetInt(i, (int)SoundConfigCol.COL_PlayTimes, 1);
            data.fDuartion                 = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_Duartion, 0);
            data.fDelayPlayTime            = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_DelayTime, 0);
            data.fIntervalBetweenPlayTimes = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_IntervalBetweenPlayTimes, 0);
            data.AssetBundleName           = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetBundleName, "");
            data.AssetName                 = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetName, "");
            data.AssetGUID                 = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetGUID, "");
            data.AssetSize_X               = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_AssetSize_X, -1);
            data.AssetSize_Y               = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_AssetSize_Y, -1);
            data.szDependAssetGUID         = SoundReader.GetString(i, (int)SoundConfigCol.COL_DependAssetGUID, "");
            if (dataSet.ContainsKey(data.nID))
            {
                SoundSystemLog(ConfigFileName + "拥有重复的ID!");
                dataSet[data.nID] = data;
            }
            else
            {
                CheckConfig(data);
                dataSet.Add(data.nID, data);
            }
        }
        SoundReader.Dispose();
        SoundReader = null;
        return(true);
    }
コード例 #11
0
ファイル: AnimSpriteConfig.cs プロジェクト: zwong91/Titan
        public void Load(string strPath)
        {
            m_dicAnimSpriteConfig = new Dictionary <string, SSchemeAnimFrameData>();

            ScpReader reader = new ScpReader(strPath, true);

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeAnimFrameData sConfig = new SSchemeAnimFrameData();
                sConfig.strAssetName = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AssetName, string.Empty);
                sConfig.strAnimName  = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AnimName, string.Empty);
                sConfig.nAnimFrame   = reader.GetInt(i, (int)EAnimSpriteConfig.EASC_AnimFrame, 1);

                string tmpAnimStartPos = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AnimStartPos, "0;0");
                sConfig.vec2AnimStartPos = new Vector2(float.Parse(tmpAnimStartPos.Split(';')[0]), float.Parse(tmpAnimStartPos.Split(';')[1]));


                string tmpAnimFrameSize = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AnimFrameSize, "32;32");
                sConfig.vec2AnimFrameSize = new List <Vector2>();
                if (tmpAnimFrameSize.Contains("|"))
                {
                    string[] sizeArray = tmpAnimFrameSize.Split('|');
                    if (sizeArray.Length != sConfig.nAnimFrame)
                    {
                        Trace.LogWarning("动画帧尺寸不一致,且尺寸数量与帧数不符,所有帧都用第一帧尺寸使用");
                        string tmpSize = sizeArray[0];
                        sConfig.vec2AnimFrameSize.Add(new Vector2(float.Parse(tmpSize.Split(';')[0]), float.Parse(tmpSize.Split(';')[1])));
                    }
                    else
                    {
                        foreach (var strSize in sizeArray)
                        {
                            sConfig.vec2AnimFrameSize.Add(new Vector2(float.Parse(strSize.Split(';')[0]), float.Parse(strSize.Split(';')[1])));
                        }
                    }
                }
                else
                {
                    sConfig.vec2AnimFrameSize.Add(new Vector2(float.Parse(tmpAnimFrameSize.Split(';')[0]), float.Parse(tmpAnimFrameSize.Split(';')[1])));
                }
                if (m_dicAnimSpriteConfig.ContainsKey(sConfig.strAnimName))
                {
                    Trace.LogWarning("有相同的动画名称:" + sConfig.strAnimName + "在表第" + i + "行.");
                }
                else
                {
                    m_dicAnimSpriteConfig.Add(sConfig.strAnimName, sConfig);
                }
            }
            reader.Dispose();
            reader = null;
        }
コード例 #12
0
        public void Load(string strPath)
        {
            m_dicUSoundTable = new Dictionary <string, SSchemeUSoundData>();
            ScpReader reader = new ScpReader(strPath, true, 1);

            sb_USoundName = new StringBuilder();

            string tmpCurrentFilter = string.Empty;
            string tmpSoundName     = string.Empty;

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

                sConfig.USoundFilter = reader.GetString(i, (int)EUSoundConfig.USC_Filter, tmpCurrentFilter);

                if (i == 0 && sConfig.USoundFilter == string.Empty)
                {
                    Trace.LogError("配置表出错!!第一行Filter不能是空的。");
                    break;
                }
                //表当前位置与上一个位置的ViewFilter一致
                else if (sConfig.USoundFilter == string.Empty)
                {
                    sConfig.USoundFilter = tmpCurrentFilter;
                }
                //表当前位置属于另一个ViewFilter
                else if (sConfig.USoundFilter != tmpCurrentFilter)
                {
                    tmpCurrentFilter = sConfig.USoundFilter;
                }

                sConfig.USoundKey = reader.GetString(i, (int)EUSoundConfig.USC_Key, string.Empty);

                sConfig.USoundID = reader.GetInt(i, (int)EUSoundConfig.USC_ID, 0);

                GetSoundName(sConfig.USoundFilter, sConfig.USoundKey, ref tmpSoundName);

                if (m_dicUSoundTable.ContainsKey(tmpSoundName))
                {
                    Trace.LogWarning("有相同的音效名称:" + sConfig.USoundFilter + "," + sConfig.USoundKey + "表第" + i + "行");
                }
                else
                {
                    m_dicUSoundTable.Add(tmpSoundName, sConfig);
                }
            }
            reader.Dispose();
            reader       = null;
            IsConfigLoad = true;
        }
コード例 #13
0
        public void Load(string strPath)
        {
            labelDescirptionTable = new Hashtable();
            ScpReader LabelDescriptionReader = new ScpReader(strPath, true, 2);

            for (int i = 0; i < LabelDescriptionReader.GetRecordCount(); i++)
            {
                int    LabelKey   = LabelDescriptionReader.GetInt(i, 1, 0);
                string LabelValue = LabelDescriptionReader.GetString(i, 0, "");

                labelDescirptionTable.Add(LabelKey, LabelValue);
            }

            LabelDescriptionReader.Dispose();
        }
コード例 #14
0
    private void ImportCSV()
    {
        string patch = AssetBundleManager.GetUICSVConfigPatch();

        if (!File.Exists(patch))
        {
            return;
        }
        m_ConfigTable.Clear();
        string stSchemeAllText = System.IO.File.ReadAllText(patch);

        //去掉\n,因为ScpReader以"\r"分割
        stSchemeAllText = stSchemeAllText.Replace("\n", "");
        //再干掉最后的"\r"
        stSchemeAllText = stSchemeAllText.Remove(stSchemeAllText.Length - 1, 1);
        ScpReader UIReader = new ScpReader(stSchemeAllText, "UIConfig", 2);

        // 遍歷整個表并存儲起來
        for (int i = 0; i < UIReader.GetRecordCount(); ++i)
        {
            UFileData data = new UFileData();
            //data.packageID = UIReader.GetInt(i, (int)AssetBundleManager.UIConfigCol.COL_ID, -1);
            data.configData.AssetBundleName = UIReader.GetString(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetBundleName, "");
            data.configData.AssetName       = UIReader.GetString(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetName, "");
            data.configData.AssetBundleName = UIReader.GetString(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetGUID, "");
            data.configData.AssetSize_X     = UIReader.GetFloat(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetSize_X, -1);
            data.configData.AssetSize_Y     = UIReader.GetFloat(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetSize_Y, -1);
            //包名已经存在了
            if (m_ConfigTable.ContainsKey(data.configData.AssetBundleName))
            {
                Dictionary <string, UFileData> ta = m_ConfigTable[data.configData.AssetBundleName];
                if (ta.ContainsKey(data.configData.AssetName))
                {
                    Debug.LogError("重复的资源名:" + data.configData.AssetName + ",包:" + data.configData.AssetBundleName);
                    continue;
                }
                ta.Add(data.configData.AssetName, data);
            }
            else
            {
                Dictionary <string, UFileData> ta = new Dictionary <string, UFileData>();
                ta.Add(data.configData.AssetName, data);
                m_ConfigTable.Add(data.configData.AssetBundleName, ta);
            }
        }
        UIReader.Dispose();
        UIReader = null;
    }
コード例 #15
0
ファイル: CreateHeroConfig.cs プロジェクト: zwong91/Titan
        public void Load(string strPath)
        {
            m_dicCreateHeroConfig = new Dictionary <PERSON_SEX, SSchemeCreateHeroConfig>();

            ScpReader reader = new ScpReader(strPath, true);

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                int nIndex = 0;
                SSchemeCreateHeroConfig sConfig = new SSchemeCreateHeroConfig();
                sConfig.nSexID     = reader.GetInt(i, (int)nIndex++, 0);
                sConfig.strHeroIDs = reader.GetString(i, (int)nIndex++, string.Empty);

                m_dicCreateHeroConfig.Add((PERSON_SEX)sConfig.nSexID, sConfig);
            }
            reader.Dispose();
            reader = null;
        }
コード例 #16
0
        private void InitGodRecommdEquip(string _defaultViewConfigPath)
        {
            string    stPath = _defaultViewConfigPath + MobaSchemesConfig.GOD_RECOMMD_EQUIPSCHEME;
            ScpReader reader = new ScpReader(stPath, true, 2);

            godRecommdEquipConfigList = new Dictionary <int, List <SSchemeGodRecommdEquip> >();
            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeGodRecommdEquip sConfig = new SSchemeGodRecommdEquip();
                sConfig.LeagueName = reader.GetString(i, (int)EGodRecommdEquip.EGRE_LeagueName, "");
                sConfig.LeagueType = reader.GetInt(i, (int)EGodRecommdEquip.EGRE_LeagueType, 0);
                sConfig.Title      = reader.GetString(i, (int)EGodRecommdEquip.EGRE_Title, "");
                sConfig.HeroID     = reader.GetInt(i, (int)EGodRecommdEquip.EGRE_HeroID, 0);
                sConfig.SchemeName = reader.GetString(i, (int)EGodRecommdEquip.EGRE_SchemeName, "");
                sConfig.AuthorName = reader.GetString(i, (int)EGodRecommdEquip.EGRE_AuthorName, "");

                sConfig.nEquipList = new int[USpeedUI.UDefines.nEquipSchemeMaxEquipNum];
                string strEquipList  = reader.GetString(i, (int)EGodRecommdEquip.EGRE_EquipList, "");
                char[] charSeparator = new char[] { MobaSchemesConfig.separator };

                List <int> intList = ScpReader.ConvertStringToIntArray(strEquipList, charSeparator);
                if (intList.Count != USpeedUI.UDefines.nEquipSchemeMaxEquipNum)
                {
                    UnityEngine.Debug.LogError("装备列表数量不对,请策划检查配置:" + stPath + ",第" + i + 1 + "条数据");
                    return;
                }
                for (int j = 0; j < USpeedUI.UDefines.nEquipSchemeMaxEquipNum; j++)
                {
                    sConfig.nEquipList[j] = intList[j];
                }

                if (!godRecommdEquipConfigList.ContainsKey(sConfig.HeroID))
                {
                    godRecommdEquipConfigList.Add(sConfig.HeroID, new List <SSchemeGodRecommdEquip>());
                }

                godRecommdEquipConfigList[sConfig.HeroID].Add(sConfig);
            }

            reader.Dispose();
        }
コード例 #17
0
        /// <summary>
        /// 初始化称号
        /// </summary>
        private void InitMobaTitleConfig(string _defaultViewConfigPath)
        {
            string    stPath = _defaultViewConfigPath + MobaSchemesConfig.MOBA_RECORD_TITLE_CONFIG;
            ScpReader reader = new ScpReader(stPath, true, 2);

            allTitleConfig = new Hashtable();
            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeTitleConfig sConfig = new SSchemeTitleConfig();
                sConfig.nId         = reader.GetInt(i, (int)EMobaTitle.EMT_ID, 0);
                sConfig.stTitleType = reader.GetString(i, (int)EMobaTitle.EMT_TYPE, "");
                sConfig.stName      = reader.GetString(i, (int)EMobaTitle.EMT_NAME, "");
                sConfig.stDesc      = reader.GetString(i, (int)EMobaTitle.EMT_DESC, "");
                if (sConfig.nId == 0)
                {
                    continue;
                }
                allTitleConfig[sConfig.nId] = sConfig;
            }
            reader.Dispose();
        }
コード例 #18
0
        /// <summary>初始化moba战绩表图形表示相关配置 </summary>
        private void InitMovaRecordTablePic(string _defaultViewConfigPath)
        {
            string    stPath = _defaultViewConfigPath + MobaSchemesConfig.MOBA_RECORD_TABLE_PIC;
            ScpReader reader = new ScpReader(stPath, true, 2);

            allDataConfig = new Hashtable();
            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeRecordConfig sConfig = new SSchemeRecordConfig();
                sConfig.nId         = reader.GetInt(i, (int)EMobaRecord.EMR_ID, 0);
                sConfig.stDesc      = reader.GetString(i, (int)EMobaRecord.EMR_DESC, "");
                sConfig.stColor     = reader.GetString(i, (int)EMobaRecord.EMR_COLOR, "");
                sConfig.nDataNumMax = reader.GetInt(i, (int)EMobaRecord.EMR_DATAMAX, 0);
                if (sConfig.nId == 0)
                {
                    continue;
                }
                allDataConfig[sConfig.nId] = sConfig;
            }

            reader.Dispose();
        }
コード例 #19
0
    public void LoadPackageList()
    {
        PackageList.Clear();
        string packcfgtxt = LoadAllTextSync(ResDef.CurrentPackageFileName);

        if (packcfgtxt != null && packcfgtxt.Length > 0)
        {
            ScpReader packageconfig = new ScpReader(packcfgtxt, "packcfgtxt");
            int       n             = packageconfig.GetRecordCount();
            for (int i = 0; i < n; i++)
            {
                string packname = packageconfig.GetString(i, 1, "");
                if (packname.Length > 0)
                {
                    PackageList [packname.ToLower()] = packname;
                }
            }
            Trace.Log("packageconfig,record count=" + n.ToString());
            Trace.Log("PackageList,record count=" + PackageList.Count.ToString());
            packageconfig.Dispose();
        }
    }
コード例 #20
0
        protected void _LoadGuideNodeConfig(string _strPath)
        {
            dicGuideConfigTable = new Dictionary <EGuideNodeID, SSchemeGuideNodeData>();

            ScpReader reader = new ScpReader(_strPath, true);

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeGuideNodeData sConfig = new SSchemeGuideNodeData();
                sConfig.nGuideID = reader.GetInt(i, (int)EGuideNodeConfig.GuideID, -1);

                sConfig.GuideStringParams = ScpReader.ToStringList(reader.GetString(i, (int)EGuideNodeConfig.GuideActionStringParams, ""), new char[] { ';' });
                sConfig.GuideIntParams    = ScpReader.ConvertStringToIntArray(reader.GetString(i, (int)EGuideNodeConfig.GuideActionIntParams, ""), new char[] { ';' });
                //sConfig.GuidePreconditionIntParams = ScpReader.ConvertStringToIntArray(reader.GetString(i, (int)EGuideNodeConfig.GuidePreconditionIntParams, ""), new char[] { ';' });

                sConfig.nGuideActionLayerType = reader.GetInt(i, (int)EGuideNodeConfig.GuideActionLayerType, 0);

                dicGuideConfigTable.Add((EGuideNodeID)sConfig.nGuideID, sConfig);
            }
            reader.Dispose();
            reader = null;
        }
コード例 #21
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;
        }
コード例 #22
0
    public void LoadResourceList()
    {
        ResourceList.Clear();
        string rescfgtxt = LoadAllTextSync(ResDef.ResourceFileName);

        if (rescfgtxt != null && rescfgtxt.Length > 0)
        {
            ScpReader resourceconfig = new ScpReader(rescfgtxt, "rescfgtxt");
            int       n = resourceconfig.GetRecordCount();
            for (int i = 0; i < n; i++)
            {
                string respath  = resourceconfig.GetString(i, 1, "");
                string packname = resourceconfig.GetString(i, 3, "");
                if (respath.Length > 0 && packname.Length > 0)
                {
                    ResourceList [respath] = packname;
                }
            }
            Trace.Log("rescfgtxt,record count=" + n.ToString());
            Trace.Log("ResourceList,record count=" + ResourceList.Count.ToString());
            resourceconfig.Dispose();
        }
    }
コード例 #23
0
ファイル: ResVerManager.cs プロジェクト: zwong91/Titan
    // 进入新的状态
    private void OnEnter(ResVerCheckState newState, ResVerCheckState oldState)
    {
        switch (newState)
        {
        case ResVerCheckState.Init:
        {
            try
            {
                // 用户目录不存在Package目录,创建Package目录
                if (!Directory.Exists(ResDef.OuterPackageDirectory))
                {
                    Directory.CreateDirectory(ResDef.OuterPackageDirectory);
                }
            }
            catch (Exception e)
            {
            }
        }
        break;

        case ResVerCheckState.Start:
        {
            m_bStartSucc = true;
        }
        break;

        case ResVerCheckState.DownPackCsv:
        {
//						// 判断User下载目录中有没有Local_Package.txt,没有就从Resources目录中拷贝
//						if (!File.Exists(ResDef.UserDownLoadDirectory + ResDef.LocalPackageFileName))
//                      {
//							TextAsset obj = (TextAsset)AssetSystem.Singleton.LoadFromResources(LoadType.CSVFile, "Scp/Package");
//                          ResTools.CreateFile(ResDef.LocalPackageFileName, ResDownFlag.PackCsvFile, obj.bytes);
//                      }

            // 请求下载New包配置文件
            uint uReqId = 0;
            ResDownManager.Instance.ReqDownLoadHandler(out uReqId, -1, ResDownFlag.PackCsvFile, ResDef.ResPackageCommonURL + ResDef.NetPackageFileName, ResDef.NewPackageFileName, this);
            m_ReqDownInfoDic.Add(uReqId, new ResDownInfo(ResDownState.NoDown, 0));
        }
        break;

        case ResVerCheckState.DownResCsv:
        {
            // 请求下载资源配置文件
            uint uReqId = 0;
            ResDownManager.Instance.ReqDownLoadHandler(out uReqId, -1, ResDownFlag.ResCsvFile, ResDef.ResPackageCommonURL + ResDef.ResourceFileName, ResDef.ResourceFileName, this);
            m_ReqDownInfoDic.Add(uReqId, new ResDownInfo(ResDownState.NoDown, 0));
        }
        break;

        case ResVerCheckState.ResVerCheck:
        {
            oldpackagelist = new Hashtable();
            newpackagelist = new Hashtable();
            newpackagekeys = new List <string>();
            checkcount     = 0;

            string NewPath = ResDef.OuterPackageDirectory + ResDef.NewPackageFileName;
            string OldPath = ResDef.OuterPackageDirectory + ResDef.CurrentPackageFileName;
            if (System.IO.File.Exists(OldPath))
            {
                string    pText     = System.IO.File.ReadAllText(OldPath);
                ScpReader scpreader = new ScpReader(pText, "oldpackagecfg");
                int       n         = scpreader.GetRecordCount();
                for (int i = 0; i < n; i++)
                {
                    string packname   = scpreader.GetString(i, 1, "");
                    int    ver        = scpreader.GetInt(i, 2, 0);
                    long   filelength = scpreader.GetLong(i, 3, 0);
                    long   datatime   = scpreader.GetLong(i, 4, 0);
                    if (packname.Length > 0 && ver > 0 && datatime > 0)
                    {
                        PackageInfo packageinfo = new PackageInfo();
                        packageinfo.name         = packname;
                        packageinfo.ver          = ver;
                        packageinfo.filelength   = filelength;
                        packageinfo.datatime     = datatime;
                        oldpackagelist[packname] = packageinfo;
                    }
                }
                Trace.Log("oldpackagelist count=" + oldpackagelist.Count.ToString());
                scpreader.Dispose();
            }
            if (System.IO.File.Exists(NewPath))
            {
                string    pText     = System.IO.File.ReadAllText(NewPath);
                ScpReader scpreader = new ScpReader(pText, "newpackagecfg");
                int       n         = scpreader.GetRecordCount();
                for (int i = 0; i < n; i++)
                {
                    string packname   = scpreader.GetString(i, 1, "");
                    int    ver        = scpreader.GetInt(i, 2, 0);
                    long   filelength = scpreader.GetLong(i, 3, 0);
                    long   datatime   = scpreader.GetLong(i, 4, 0);
                    if (packname.Length > 0 && ver > 0 && datatime > 0)
                    {
                        PackageInfo packageinfo = new PackageInfo();
                        packageinfo.name         = packname;
                        packageinfo.ver          = ver;
                        packageinfo.filelength   = filelength;
                        packageinfo.datatime     = datatime;
                        newpackagelist[packname] = packageinfo;
                        newpackagekeys.Add(packname);
                    }
                }
                Trace.Log("newpackagelist count=" + newpackagelist.Count.ToString());
                Trace.Log("newpackagekeys count=" + newpackagekeys.Count.ToString());
                scpreader.Dispose();
            }

//						foreach(DictionaryEntry newkeypair in newpackagelist)
//						{
//							string newpackagename=(string)newkeypair.Key;
//							PackageInfo newpackageinfo=(PackageInfo)newkeypair.Value;
//							if (oldpackagelist.Contains(newpackagename))
//							{
//								PackageInfo oldpackageinfo=(PackageInfo)oldpackagelist[newpackagename];
//								//有更新变化
//								if (newpackageinfo.ver>oldpackageinfo.ver ||
//									newpackageinfo.filelength!=oldpackageinfo.filelength||
//									newpackageinfo.datatime!=oldpackageinfo.datatime)
//								{
//									m_NeedDownPackList.Add(newpackagename);
//								}
//								else//无更新变化
//								{
//									string destpath= ResDef.UserPackageDirectory+newpackagename+ext;
//									//文件不存在,重新下
//									if (System.IO.File.Exists(destpath)==false)
//									{
//										m_NeedDownPackList.Add(newpackagename);
//										continue;
//									}
//
//									//本地文件大小跟配置的不一样,重新下
//									FileInfo fi = new FileInfo(destpath);
//									if (fi.Length!=newpackageinfo.filelength)
//									{
//										m_NeedDownPackList.Add(newpackagename);
//										continue;
//									}
//								}
//							}
//							// 新增包
//					        else
//					        {
//					            m_NeedDownPackList.Add(newpackagename);
//					        }
//						}

            // 资源版本检查完成
            //m_bResVerCheckIsOver = true;
        }
        break;

        case ResVerCheckState.DownResPack:
        {
            if (m_NeedDownPackList.Count > 0)
            {
                for (int i = 0; i < m_NeedDownPackList.Count; ++i)
                {
                    // 获取对应的New包配置数据
                    //PackageData data = m_newPackageCsv.GetCsvValue(m_NeedDownPackList[i]);
                    string packname = m_NeedDownPackList[i] + ext;

                    // 请求下载资源包
                    uint uReqId = 0;
                    ResDownManager.Instance.ReqDownLoadHandler(out uReqId, -1, ResDownFlag.ResPackage, ResDef.ResPackageCommonURL + packname, packname, this);
                    m_ReqDownInfoDic.Add(uReqId, new ResDownInfo(ResDownState.NoDown, 0));
                }

                // todo开始显示进度条
            }
        }
        break;

        case ResVerCheckState.Finished:
        {
            // 取消订阅Update事件
            //SubscribeUpdateEvent(false);

            string NewPath = ResDef.OuterPackageDirectory + ResDef.NewPackageFileName;
            string OldPath = ResDef.OuterPackageDirectory + ResDef.CurrentPackageFileName;

            //copy new_package.csv as local_package.csv
            if (File.Exists(NewPath))
            {
                File.Copy(NewPath, OldPath, true);
            }



            // 资源版本管理流程结束
            bResVerMgrIsOver = true;
        }
        break;

        default:
            break;
        }
    }
コード例 #24
0
        private static void LoadSoundConfig()
        {
            string patch = GetConfigPatch();

            //if (!File.Exists(patch))
            //{
            //    return;
            //}
            //string stSchemeAllText = System.IO.File.ReadAllText(patch);

            ////去掉\n,因为ScpReader以"\r"分割
            //stSchemeAllText = stSchemeAllText.Replace("\n", "");
            ////再干掉最后的"\r"
            //stSchemeAllText = stSchemeAllText.Remove(stSchemeAllText.Length - 1, 1);
            //ScpReader SoundReader = new ScpReader(stSchemeAllText, "SoundConfig", 2);

            ScpReader SoundReader = new ScpReader(patch, true, 2);

            // 遍歷整個表并存儲起來
            for (int i = 0; i < SoundReader.GetRecordCount(); ++i)
            {
                EditorSoundConfigData cfgData = new EditorSoundConfigData();
                cfgData.data                           = new SoundConfigData();
                cfgData.data.nID                       = SoundReader.GetInt(i, (int)SoundConfigCol.COL_ID, 0);
                cfgData.data.soundType                 = (EMSoundType)SoundReader.GetInt(i, (int)SoundConfigCol.COL_Type, 2);
                cfgData.data.mixerGroupType            = (AudioMixerGroupType)SoundReader.GetInt(i, (int)SoundConfigCol.COL_MixerGroupType, 1);
                cfgData.data.nMixerGroupIndex          = SoundReader.GetInt(i, (int)SoundConfigCol.COL_MixerGroupIndex, 0);
                cfgData.data.bBypassEffect             = SoundReader.GetInt(i, (int)SoundConfigCol.COL_BypassEffect, 0) > 0;
                cfgData.data.bBypassReverbZone         = SoundReader.GetInt(i, (int)SoundConfigCol.COL_BypassReverbZone, 0) > 0;
                cfgData.data.bPlayOnAwake              = SoundReader.GetInt(i, (int)SoundConfigCol.COL_PlayOnAwake, 1) > 0;
                cfgData.data.nPriority                 = Mathf.Clamp(SoundReader.GetInt(i, (int)SoundConfigCol.COL_Priority, 128), 0, 256);
                cfgData.data.fPitch                    = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_Pitch, 1), -3.0f, 3.0f);
                cfgData.data.fStereoPan                = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_StereoPan, 0), -1.0f, 1.0f);
                cfgData.data.fReverZoneMix             = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_ReverZoneMix, 1), 0, 1.1f);
                cfgData.data.b3DSound                  = SoundReader.GetInt(i, (int)SoundConfigCol.COL_3DSound, 1) > 0;
                cfgData.data.fDopplerLv                = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_DopplerLv, 1), 0, 5.0f);
                cfgData.data.nSpread                   = Mathf.Clamp(SoundReader.GetInt(i, (int)SoundConfigCol.COL_Spread, 0), 0, 360);;
                cfgData.data.audioRoffType             = (AudioRolloffMode)SoundReader.GetInt(i, (int)SoundConfigCol.COL_RolloffMode, 0);
                cfgData.data.fMinDistance              = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_MinDistance, 1);
                cfgData.data.fMaxDistance              = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_MaxDistance, 15);
                cfgData.data.nPlayTimes                = SoundReader.GetInt(i, (int)SoundConfigCol.COL_PlayTimes, 1);
                cfgData.data.fDuartion                 = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_Duartion, 0);
                cfgData.data.fDelayPlayTime            = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_DelayTime, 0);
                cfgData.data.fIntervalBetweenPlayTimes = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_IntervalBetweenPlayTimes, 0);
                cfgData.data.AssetBundleName           = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetBundleName, "");
                cfgData.data.AssetName                 = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetName, "");
                cfgData.data.AssetGUID                 = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetGUID, "");
                cfgData.data.AssetSize_X               = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_AssetSize_X, -1);
                cfgData.data.AssetSize_Y               = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_AssetSize_Y, -1);
                cfgData.data.szDependAssetGUID         = SoundReader.GetString(i, (int)SoundConfigCol.COL_DependAssetGUID, "");
                cfgData.HostTreeViewName               = string.Empty;
                CurrentSoundConfigTable.Add(cfgData.data.nID, cfgData);
                SoundIDAllocator.Instance.PushUsedId(cfgData.data.nID);
            }
            SoundIDAllocator.Instance.CalculateUnUsedID();
            SoundReader.Dispose();
            SoundReader = null;

            currentSelectedConfig = null;
            GenrateConfigTreeView();
        }
コード例 #25
0
ファイル: SoldierCamera_Nav.cs プロジェクト: zwong91/Titan
    public void LoadNavInfoFromText(string text, string tag)
    {
        if (NavNodeGroup != null)
        {
            for (int index = 0; index < NavNodeGroup.transform.childCount; index++)
            {
                Transform tchild = NavNodeGroup.transform.GetChild(index);
                var       temp   = tchild.gameObject;
                ResNode.DestroyRes(ref temp);
            }
        }


        ScpReader reader = new ScpReader(text, tag);

        for (int i = 0; i < reader.GetRecordCount(); i++)
        {
            string cmd = reader.GetString(i, 0, "");
            if (cmd != "node")
            {
                continue;
            }

            Vector3 pos;
            pos.x = reader.GetFloat(i, 1, 0.0f);
            pos.y = reader.GetFloat(i, 2, 0.0f);
            pos.z = reader.GetFloat(i, 3, 0.0f);
            Vector3 angle;
            angle.x = reader.GetFloat(i, 4, 0.0f);
            angle.y = reader.GetFloat(i, 5, 0.0f);
            angle.z = reader.GetFloat(i, 6, 0.0f);
            Vector3 dir;
            dir.x = reader.GetFloat(i, 7, 0.0f);
            dir.y = reader.GetFloat(i, 8, 0.0f);
            dir.z = reader.GetFloat(i, 9, 0.0f);
            Vector3 tran;
            tran.x = reader.GetFloat(i, 10, 0.0f);
            tran.y = reader.GetFloat(i, 11, 0.0f);
            tran.z = reader.GetFloat(i, 12, 0.0f);
            float distance;
            distance = reader.GetFloat(i, 13, 0.0f);
            float fov;
            fov = reader.GetFloat(i, 14, 0.0f);
            int count;
            count = reader.GetInt(i, 15, 0);
            float range;
            range = reader.GetFloat(i, 16, NavDefRange);
            range = Mathf.Clamp(range, 0.0f, 100.0f);
            bool locked;
            locked = reader.GetInt(i, 17, 0) != 0;

            GameObject    go   = BuildNavNode(pos, angle, dir, tran, distance, fov);
            CameraNavNode info = go.AddComponent <CameraNavNode>();
            info.pos      = pos;
            info.angle    = angle;
            info.dir      = dir;
            info.tran     = tran;
            info.distance = distance;
            info.fov      = fov;
            info.count    = 1;
            info.range    = range;
            info.locked   = locked;
        }

        reader.Dispose();
    }
コード例 #26
0
    static void GenerateListFromAssetBunldesPlatform(string platform)
    {
        Caching.CleanCache();

        //generate resource list
        {
            string       ListPath = Application.dataPath + "/AssetBundles/" + platform + "/list.csv";
            StreamWriter sw       = new StreamWriter(ListPath, false);
            sw.WriteLine("#,Path,Type,Package");

            string[] strPackagePaths = System.IO.Directory.GetFiles(Application.dataPath + "/AssetBundles/" + platform, "*.txt");
            for (int j = 0; j < strPackagePaths.Length; j++)
            {
                string strPackagePath = strPackagePaths[j];
                string packname       = System.IO.Path.GetFileNameWithoutExtension(strPackagePath);

                string[] lines = System.IO.File.ReadAllLines(strPackagePath);

                if (lines != null && lines.Length > 1)
                {
                    for (int i = 1; i < lines.Length; i++)
                    {
                        string   szline = lines[i];
                        string[] cels   = szline.Split("," [0]);
                        cels[1] = cels[1].ToLower();
                        string szfinal = "";
                        for (int k = 0; k < cels.Length; k++)
                        {
                            szfinal += cels[k];
                            if (k != cels.Length - 1)
                            {
                                szfinal += ",";
                            }
                        }
                        sw.WriteLine(szfinal);
                    }
                }

                sw.Flush();

                float fProgress = (float)j / (float)(strPackagePaths.Length);
                EditorUtility.DisplayProgressBar("Generate Resource List", "generate list for:" + strPackagePath + "...", fProgress);
            }

            sw.Close();
        }


        //generate package list
        {
            string ListPath = Application.dataPath + "/AssetBundles/" + platform + "/package.csv";

            Hashtable oldversions = new Hashtable();
            if (System.IO.File.Exists(ListPath))
            {
                string    oldpackagecfgtext = System.IO.File.ReadAllText(ListPath);
                ScpReader oldpackagecfg     = new ScpReader(oldpackagecfgtext, "oldpackagelist");
                int       n = oldpackagecfg.GetRecordCount();
                for (int j = 0; j < n; j++)
                {
                    string packname = oldpackagecfg.GetString(j, 1, "");
                    int    ver      = oldpackagecfg.GetInt(j, 2, 0);
                    if (packname.Length > 0 && ver > 0)
                    {
                        oldversions[packname] = ver;
                    }
                }
                oldpackagecfg.Dispose();
            }

            StreamWriter sw = new StreamWriter(ListPath, false);
            sw.WriteLine("#,name,version,filelength,datatimevalue,datatimestring");

            string[] strPackagePaths = System.IO.Directory.GetFiles(Application.dataPath + "/AssetBundles/" + platform, "*.txt");
            for (int j = 0; j < strPackagePaths.Length; j++)
            {
                string strTextPath    = strPackagePaths[j];
                string packname       = Path.GetFileNameWithoutExtension(strTextPath);
                string dir            = Path.GetDirectoryName(strTextPath);
                string strPackagePath = dir + "/" + packname + ".unity3d";
                string strEncryptPath = dir + "/" + packname + ".zen";
                if (!File.Exists(strPackagePath))
                {
                    continue;
                }
                long            filelength = 0;
                System.DateTime lasttime;
                if (bEncrypt)
                {
                    byte[] inputdata = File.ReadAllBytes(strPackagePath);
                    if (inputdata == null)
                    {
                        continue;
                    }
                    string key        = packname + "*^$@&%#!";
                    byte[] outputdata = AssetSystem.EncryptDES(inputdata, key);
                    if (outputdata == null)
                    {
                        continue;
                    }
                    File.WriteAllBytes(strEncryptPath, outputdata);
                    byte[] testdata = File.ReadAllBytes(strEncryptPath);
                    filelength = testdata.Length;
                    if (filelength <= 0 || filelength != outputdata.Length)
                    {
                        continue;
                    }
                    lasttime = File.GetLastWriteTime(strEncryptPath);
                }
                else
                {
                    byte[] inputdata = File.ReadAllBytes(strPackagePath);
                    if (inputdata == null)
                    {
                        continue;
                    }
                    filelength = inputdata.Length;
                    if (filelength <= 0)
                    {
                        continue;
                    }
                    lasttime = File.GetLastWriteTime(strPackagePath);
                }

                int ver = 1;
                if (oldversions.Contains(packname))
                {
                    ver = (int)oldversions[packname];
                }
                if (ver <= 0)
                {
                    continue;
                }
                sw.WriteLine(j.ToString() + "," + packname + "," + ver.ToString() + "," + filelength.ToString() + "," + lasttime.ToFileTime().ToString() + "," + lasttime.ToString());
                sw.Flush();

                float fProgress = (float)j / (float)(strPackagePaths.Length);
                EditorUtility.DisplayProgressBar("Generate package List", "generate list for:" + strPackagePath + "...", fProgress);
            }

            sw.Close();
        }

        EditorUtility.ClearProgressBar();
    }