// 初始化csv表
        protected void InitWarSupportPositionConfigCsv(string stPath)
        {
            ScpReader reader = new ScpReader(stPath, true, 2);

            allWarSupportPositionConfigTable = new Hashtable();
            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                int nCol = 0;
                SSchemeWarSupportPositionConfig sConfig = new SSchemeWarSupportPositionConfig();
                sConfig.nSortID            = reader.GetInt(i, nCol++, 0);
                sConfig.nPlayerCount       = reader.GetInt(i, nCol++, 0);
                sConfig.fUIPositionOffsetX = reader.GetFloat(i, nCol++, 0.0f);
                sConfig.playerOffsetVec3.x = reader.GetFloat(i, nCol++, 0.0f);
                sConfig.playerOffsetVec3.y = reader.GetFloat(i, nCol++, 0.0f);
                sConfig.playerOffsetVec3.z = reader.GetFloat(i, nCol++, 0.0f);

                if (allWarSupportPositionConfigTable.ContainsKey(sConfig.nSortID))
                {
                    (allWarSupportPositionConfigTable[sConfig.nSortID] as List <SSchemeWarSupportPositionConfig>).Add(sConfig);
                }
                else
                {
                    List <SSchemeWarSupportPositionConfig> positionList = new List <SSchemeWarSupportPositionConfig>();
                    positionList.Add(sConfig);
                    allWarSupportPositionConfigTable[sConfig.nSortID] = positionList;
                }
            }
        }
Exemple #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;
        }
    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;
    }
Exemple #4
0
        private void InitCameraConfigCsv(string stPath)
        {
            ScpReader reader = new ScpReader(stPath, true, 2);

            CameraConfigTable = new Hashtable();

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                int index  = reader.GetInt(i, (int)CamConfig.EMT_INDEX, 0);
                int heroID = reader.GetInt(i, (int)CamConfig.EMT_HEROTYPE, 0);
                int mapID  = reader.GetInt(i, (int)CamConfig.EMT_MAPTYPE, 0);


                SoldierCamera.CameraParam[] caminfo = new SoldierCamera.CameraParam[4];

                int modeAttributeCount = 8;//每一项有8个参数
                for (int mode = 0; mode < 4; mode++)
                {
                    caminfo[mode]             = new SoldierCamera.CameraParam();
                    caminfo[mode].curDistance = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_DEFAULTDISTANCE, 0);
                    Vector2 disRange = new Vector2();
                    disRange.x = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MINDISTANCE, 0);
                    disRange.y = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MAXDISTANCE, 0);
                    caminfo[mode].distanceRange = disRange;
                    caminfo[mode].curPitchAngle = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_DEFAULTANGLE, 0);
                    Vector2 angleRange = new Vector2();
                    angleRange.x = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MINANGLE, 0);
                    angleRange.y = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MAXANGLE, 0);
                    caminfo[mode].pitchAngleRange = angleRange;
                    caminfo[mode].targetOffset    = reader.GetFloat(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_TARGETOFFSET, 0);
                    caminfo[mode].FOV             = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_FOV, 0);
                }
                CameraConfigTable[mapID * MAX_HERO_TYPE + heroID] = caminfo;
            }
        }
Exemple #5
0
        //加载参数信息
        private void LoadParamNode(ScpReader reader, int row)
        {
            int nIndex = reader.GetInt(row, (int)Column_OBCtrl.COL_INDEX, 0);

            if (m_dicOBCtrlParamNodeMap.ContainsKey(nIndex))
            {
                Trace.Log("scheme repeat! row = " + row + "file:" + schemeFileName);
                return;
            }

            float fDefault = reader.GetFloat(row, (int)Column_OBCtrl.COL_DEFAULT, 0f);
            float fMin     = reader.GetFloat(row, (int)Column_OBCtrl.COL_MIN, 0f);
            float fMax     = reader.GetFloat(row, (int)Column_OBCtrl.COL_MAX, 0f);

            SchemeOBCtrlParamNode node = new SchemeOBCtrlParamNode(nIndex, fDefault, fMin, fMax);

            m_dicOBCtrlParamNodeMap.Add(nIndex, node);
        }
Exemple #6
0
        private void LoadPropertyPanelConfig(string stPath)
        {
            ScpReader reader = new ScpReader(stPath, true, 2);

            m_dicPropertyPanel = new Dictionary <int, List <SSchemePropertyPanel> >();
            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemePropertyPanel node = new SSchemePropertyPanel();
                node.nHeroID        = reader.GetInt(i, (int)EPropertyPanelCol.EPPC_HERO, 0);
                node.nPropertyID    = reader.GetInt(i, (int)EPropertyPanelCol.EPPC_PROPERTY, 0);
                node.fPropertyLevel = reader.GetFloat(i, (int)EPropertyPanelCol.EPPC_LEVEL, 0.0f);
                node.strColor       = reader.GetString(i, (int)EPropertyPanelCol.EPPC_COLOR, "");
                node.strDesc        = reader.GetString(i, (int)EPropertyPanelCol.EPPC_DESC, "");

                if (!m_dicPropertyPanel.ContainsKey(node.nHeroID))
                {
                    List <SSchemePropertyPanel> listConfig = new List <SSchemePropertyPanel>();
                    m_dicPropertyPanel.Add(node.nHeroID, listConfig);
                }
                m_dicPropertyPanel[node.nHeroID].Add(node);
            }
        }
Exemple #7
0
        // 初始化csv表
        protected void InitPersonModelTransFormInfoCsv(string stPath)
        {
            // string stSchemeAllText = File.ReadAllText(stPath);
            ScpReader reader = new ScpReader(stPath, true, 2);

            allPersonModelTransFormInfoTable = new Hashtable();
            int nIndex = 0;

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                nIndex = 0;

                HeroModelTransFormInfo singleHeroInfo = new HeroModelTransFormInfo();

                singleHeroInfo.nHeroId = reader.GetInt(i, (int)nIndex++, 0);
                int nViewId = reader.GetInt(i, (int)nIndex++, 0);
                singleHeroInfo.Position.x = reader.GetFloat(i, (int)nIndex++, 0);
                singleHeroInfo.Position.y = reader.GetFloat(i, (int)nIndex++, 0);
                singleHeroInfo.Position.z = reader.GetFloat(i, (int)nIndex++, 0);
                singleHeroInfo.Rotation.x = reader.GetInt(i, (int)nIndex++, 0);
                singleHeroInfo.Rotation.y = reader.GetInt(i, (int)nIndex++, 0);
                singleHeroInfo.Rotation.z = reader.GetInt(i, (int)nIndex++, 0);
                singleHeroInfo.Scale.x    = reader.GetFloat(i, (int)nIndex++, 0);
                singleHeroInfo.Scale.y    = reader.GetFloat(i, (int)nIndex++, 0);
                singleHeroInfo.Scale.z    = reader.GetFloat(i, (int)nIndex++, 0);

                if (!allPersonModelTransFormInfoTable.ContainsKey(nViewId))
                {
                    ViewHeroModelInfo ViewHeroInfo = new ViewHeroModelInfo();
                    ViewHeroInfo.dicAllViewHeroModel[singleHeroInfo.nHeroId] = singleHeroInfo;
                    ViewHeroInfo.nViewId = nViewId;
                    allPersonModelTransFormInfoTable[ViewHeroInfo.nViewId] = ViewHeroInfo;
                }
                else
                {
                    ViewHeroModelInfo ViewHeroInfo = allPersonModelTransFormInfoTable[nViewId] as ViewHeroModelInfo;
                    ViewHeroInfo.dicAllViewHeroModel[singleHeroInfo.nHeroId] = singleHeroInfo;
                }
            }
        }
Exemple #8
0
        protected void InitCrownPageConfigExteriorCsv(string stPath)
        {
            ScpReader reader = new ScpReader(stPath, true, 2);

            allCrownPageConfigExteriorTable = new Hashtable();
            int nIndex = 0;

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                nIndex = 0;
                SSchemeCrownGemstoneExteriorConfig sConfig = new SSchemeCrownGemstoneExteriorConfig();
                sConfig.nExteriorID = reader.GetInt(i, nIndex++, 0);
                sConfig.nFacescore  = reader.GetInt(i, nIndex++, 0);
                sConfig.nColours    = reader.GetFloat(i, nIndex++, 0.0f);
                sConfig.nLight      = reader.GetFloat(i, nIndex++, 0.0f);
                sConfig.nTexture    = reader.GetFloat(i, nIndex++, 0.0f);
                sConfig.nWeight     = reader.GetFloat(i, nIndex++, 0.0f);
                sConfig.szModelPath = reader.GetString(i, nIndex++, "");
                sConfig.fScale      = reader.GetFloat(i, nIndex++, 0.0f);
                sConfig.fScale2     = reader.GetFloat(i, nIndex++, 0.0f);
                allCrownPageConfigExteriorTable[sConfig.nExteriorID] = sConfig;
            }
        }
        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();
        }
Exemple #10
0
    //BipedIK一直都是null,注释掉,浪费性能
//#if USE_TIMMER_BEHAVIOUR
//    public override void OnLateUpdate()
//#else
//    public void LateUpdate()
//#endif
//    {
//        if (!ikenable)
//        {
//            return;
//        }

//        BipedIK bipedik = GetComponent<BipedIK>();
//        if (bipedik == null) return;

//        bipedik.LateUpdateEx();

//    }

    public bool LoadSetting(string path)
    {
        if (path.Length <= 0)
        {
            Debug.Log("Load Bone Setting Fail, path is empty");
            return(false);
        }

        if (!Application.isPlaying)
        {
            Debug.Log("Load Bone Setting Fail, please do it in playing mode!");
            return(false);
        }

        if (File.Exists(path) == false)
        {
            return(false);
        }

        CombinedBone[] cbs = this.GetComponentsInChildren <CombinedBone>();
        Dictionary <string, CombinedBone> cbmap = new Dictionary <string, CombinedBone>();

        foreach (CombinedBone cb in cbs)
        {
            cbmap[cb.name] = cb;
        }

        string    text = File.ReadAllText(path);
        ScpReader sr   = new ScpReader(text, path);
        int       n    = sr.GetRecordCount();

        for (int i = 0; i < n; i++)
        {
            string cmd = sr.GetString(i, 0, "");
            if (cmd != "bone")
            {
                continue;
            }

            string bonename       = sr.GetString(i, 1, "");
            int    rotationlock   = sr.GetInt(i, 2, 0);
            float  rotationweight = sr.GetFloat(i, 3, 0);
            int    poslock        = sr.GetInt(i, 4, 0);
            float  posweight      = sr.GetFloat(i, 5, 0);
            int    scalelock      = sr.GetInt(i, 6, 0);
            float  scaleweight    = sr.GetFloat(i, 7, 0);

            if (cbmap.ContainsKey(bonename))
            {
                CombinedBone cb = cbmap[bonename];
                cb.rotationlock   = (rotationlock != 0);
                cb.rotationweight = rotationweight;
                cb.poslock        = (poslock != 0);
                cb.posweight      = posweight;
                cb.scalelock      = (scalelock != 0);
                cb.scaleweight    = scaleweight;
            }
        }

        return(true);
    }
Exemple #11
0
    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();
    }
Exemple #12
0
        void AddSchemeNode(int nType, ScpReader reader, int row)
        {
            switch (nType)
            {
            case (int)LightingEffectConfigType.Bind:
            {
                LightingEffect_Bind bindEffect = ScriptableObject.CreateInstance <LightingEffect_Bind>();
                FillBaseData(bindEffect, reader, row);

                bindEffect.bCreateOutsideScreen = reader.GetInt(row, (int)Column_Bind.COL_CREATEOUTSCREEN, 0) > 0 ? true : false;
                bindEffect.scale             = reader.GetFloat(row, (int)Column_Bind.COL_SCALE, 0);
                bindEffect.effectStartTick   = reader.GetInt(row, (int)Column_Bind.COL_STARTTICK, 0);
                bindEffect.effectLiveTick    = reader.GetInt(row, (int)Column_Bind.COL_LIVETICK, 0);
                bindEffect.effectDispearTick = reader.GetInt(row, (int)Column_Bind.COL_DISPEARTICK, 0);
                bindEffect.posBindBone       = reader.GetString(row, (int)Column_Bind.COL_POSBINDBONE, "");

                string[] posOffsetStrArry = reader.GetString(row, (int)Column_Bind.COL_POSOFFSET, "").Split(';');
                bindEffect.posOffset = StrArry2Vector3(posOffsetStrArry);

                bindEffect.rotationBindBone = reader.GetString(row, (int)Column_Bind.COL_ROTBINDBONE, "");

                string[] rotationOffsetStrArry = reader.GetString(row, (int)Column_Bind.COL_ROTOFFSET, "").Split(';');
                bindEffect.rotationOffset = StrArry2Vector3(rotationOffsetStrArry);

                bindEffect.faceToCamera    = reader.GetInt(row, (int)Column_Bind.COL_FACETOCAM, 0) > 0 ? true : false;
                bindEffect.offsetToSurface = reader.GetInt(row, (int)Column_Bind.COL_OFFSETTOSURFACE, 0) > 0 ? true : false;

                int bindType = reader.GetInt(row, (int)Column_Bind.COL_BINDTYPE, 0);
                if (Enum.IsDefined(typeof(BindType), bindType))
                {
                    bindEffect.bindType = (BindType)bindType;
                }

                bindEffect.faceAganistTarget      = reader.GetInt(row, (int)Column_Bind.COL_FACEAGNISTTARGET, 0) > 0 ? true : false;
                bindEffect.bProjectOnFloor        = reader.GetInt(row, (int)Column_Bind.COL_PROJONFLOOR, 0) > 0 ? true : false;
                bindEffect.faceToWalkingDirection = reader.GetInt(row, (int)Column_Bind.COL_FACETOWALKINGDIR, 0) > 0 ? true : false;
                bindEffect.bNotRotate             = reader.GetInt(row, (int)Column_Bind.COL_NOTROTATE, 0) > 0 ? true : false;
                bindEffect.bindTargetToSource     = reader.GetInt(row, (int)Column_Bind.COL_BINDTARGETTOSRC, 0) > 0 ? true : false;
                bindEffect.bindTargetBone         = reader.GetString(row, (int)Column_Bind.COL_BINDTARGETBONE, "");
                bindEffect.triggerHitDetect       = reader.GetInt(row, (int)Column_Bind.COL_TRIGGERHITDETECT, 0) > 0 ? true : false;
                bindEffect.SoundID      = reader.GetInt(row, (int)Column_Bind.COL_SOUND, 0);
                bindEffect.posBindWound = reader.GetString(row, (int)Column_Bind.COL_POSBINDWOUND, "");

                AddLightEffect(bindEffect);
            }
            break;

            case (int)LightingEffectConfigType.Fly:
            {
                LightingEffect_Fly flyEffect = ScriptableObject.CreateInstance <LightingEffect_Fly>();
                FillBaseData(flyEffect, reader, row);

                flyEffect.scale             = reader.GetFloat(row, (int)Column_Fly.COL_SCALE, 0);
                flyEffect.effectStartTick   = reader.GetInt(row, (int)Column_Fly.COL_STARTTICK, 0);
                flyEffect.effectLiveTick    = reader.GetInt(row, (int)Column_Fly.COL_LIVETICK, 0);
                flyEffect.residenceTick     = reader.GetInt(row, (int)Column_Fly.COL_RESIDENCETICK, 0);
                flyEffect.effectDispearTick = reader.GetInt(row, (int)Column_Fly.COL_DISPEARTICK, 0);
                flyEffect.maxDistance       = reader.GetFloat(row, (int)Column_Fly.COL_MAXDISTANCE, 0);
                flyEffect.posBindBone       = reader.GetString(row, (int)Column_Fly.COL_POSBINDBONE, "");
                flyEffect.rotationBindBone  = reader.GetString(row, (int)Column_Fly.COL_ROTATIONBINDBONE, "");

                string[] posOffsetStrArry = reader.GetString(row, (int)Column_Fly.COL_POSOFFSET, "").Split(';');
                flyEffect.posOffset = StrArry2Vector3(posOffsetStrArry);

                string[] startPosOffsetStrArry = reader.GetString(row, (int)Column_Fly.COL_STARTPOSOFFSET, "").Split(';');
                flyEffect.startPosOffset = StrArry2Vector3(startPosOffsetStrArry);

                flyEffect.targetTransformBone = reader.GetString(row, (int)Column_Fly.COL_TARGETTRSBONE, "");

                string[] targetOffsetStrArry = reader.GetString(row, (int)Column_Fly.COL_TARGETOFFSET, "").Split(';');
                flyEffect.targetOffset = StrArry2Vector3(targetOffsetStrArry);

                int flyType = reader.GetInt(row, (int)Column_Fly.COL_FLYTYPE, 0);
                if (Enum.IsDefined(typeof(FlyType), flyType))
                {
                    flyEffect.flyType = (FlyType)flyType;
                }

                int StartType = reader.GetInt(row, (int)Column_Fly.COL_STARTTYPE, 0);
                if (Enum.IsDefined(typeof(StartPosType), StartType))
                {
                    flyEffect.startType = (StartPosType)StartType;
                }

                flyEffect.faceTarget             = reader.GetInt(row, (int)Column_Fly.COL_FACETARGET, 0) > 0 ? true : false;
                flyEffect.lowestHeight           = reader.GetFloat(row, (int)Column_Fly.COL_LOWESTHEIGHT, 0);
                flyEffect.highestHeight          = reader.GetFloat(row, (int)Column_Fly.COL_HIGHESTHEIGHT, 0);
                flyEffect.flySpeed               = reader.GetFloat(row, (int)Column_Fly.COL_FLYSPEED, 0);
                flyEffect.AbsFlyTime             = reader.GetFloat(row, (int)Column_Fly.COL_ABSFLYTIME, 0);
                flyEffect.destroyWhenReached     = reader.GetInt(row, (int)Column_Fly.COL_DESTROYWHENREACHED, 0) > 0 ? true : false;
                flyEffect.destroyWhenTargetDead  = reader.GetInt(row, (int)Column_Fly.COL_DESTROYWHENTARGETDEAD, 0) > 0 ? true : false;
                flyEffect.useCollision           = reader.GetInt(row, (int)Column_Fly.COL_USECOLLISION, 0) > 0 ? true : false;
                flyEffect.destroyWhenCollision   = reader.GetInt(row, (int)Column_Fly.COL_DESTROYWHENCOLLISION, 0) > 0 ? true : false;
                flyEffect.reviseFly              = reader.GetInt(row, (int)Column_Fly.COL_REVISEFLY, 0) > 0 ? true : false;
                flyEffect.effectReturn           = reader.GetInt(row, (int)Column_Fly.COL_EFFECTRETURN, 0) > 0 ? true : false;
                flyEffect.closeReturn            = reader.GetInt(row, (int)Column_Fly.COL_CLOSERETURN, 0) > 0 ? true : false;
                flyEffect.returnSpeed            = reader.GetFloat(row, (int)Column_Fly.COL_RETURNSPEED, 0);
                flyEffect.faceSourceToTarget     = reader.GetFloat(row, (int)Column_Fly.COL_FACESRCTOTARGET, 0) > 0 ? true : false;
                flyEffect.effectIDWhenHitPlayer  = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDHITPLAYER, "");
                flyEffect.effectIDWhenHitMonster = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDHITMONSTER, "");
                flyEffect.effectIDWhenHitGround  = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDHITGROUND, "");
                flyEffect.effectIDWhenReached    = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDREACH, "");
                flyEffect.triggerHitDetect       = reader.GetInt(row, (int)Column_Fly.COL_TRIGGERHITDETECT, 0) > 0 ? true : false;
                flyEffect.playAnimWhenClose      = reader.GetString(row, (int)Column_Fly.COL_PLAYANIMWHENCLOSE, "");
                flyEffect.upcastMotion           = reader.GetFloat(row, (int)Column_Fly.COL_UPCASTMOTION, 0) > 0 ? true : false;
                flyEffect.upcastHeight           = reader.GetFloat(row, (int)Column_Fly.COL_UPCASTHEIGHT, 0);
                flyEffect.minUpcastAngle         = reader.GetFloat(row, (int)Column_Fly.COL_MINUPCASTANGLE, 0);
                flyEffect.maxUpcastAngle         = reader.GetFloat(row, (int)Column_Fly.COL_MAXUPCASTANGLE, 0);
                flyEffect.upcastTopPrec          = reader.GetFloat(row, (int)Column_Fly.COL_UPCASTTOPPREC, 0);
                flyEffect.SoundID          = reader.GetInt(row, (int)Column_Fly.COL_SOUND, 0);
                flyEffect.delayDestroyTick = reader.GetInt(row, (int)Column_Fly.COL_DELAYDESTROYTICK, 0);
                flyEffect.delayHideTick    = reader.GetInt(row, (int)Column_Fly.COL_DELAYHIDETICK, 0);
                flyEffect.attackToObject   = reader.GetInt(row, (int)Column_Fly.COL_ATTACKTOOBJECT, 0) > 0 ? true : false;
                flyEffect.AffectedShield   = reader.GetInt(row, (int)Column_Fly.COL_AFFECTSHIELD, 0) > 0 ? true : false;

                AddLightEffect(flyEffect);
            }
            break;

            case (int)LightingEffectConfigType.AniReplace:
            {
                LightingEffect_AnimationReplace aniReplaceEffect = ScriptableObject.CreateInstance <LightingEffect_AnimationReplace>();
                FillBaseData(aniReplaceEffect, reader, row);

                aniReplaceEffect.nStartTick = reader.GetInt(row, (int)Column_AnimReplace.COL_STARTTICK, 0);
                aniReplaceEffect.nEndTick   = reader.GetInt(row, (int)Column_AnimReplace.COL_ENDTICK, 0);

                AddLightEffect(aniReplaceEffect);
            }
            break;

            case (int)LightingEffectConfigType.Area:
            {
                LightingEffect_Area areaEffect = ScriptableObject.CreateInstance <LightingEffect_Area>();
                FillBaseData(areaEffect, reader, row);

                areaEffect.effectStartTick    = reader.GetInt(row, (int)Column_Area.COL_STARTTICK, 0);
                areaEffect.effectIntervalTick = reader.GetInt(row, (int)Column_Area.COL_INTERVTICK, 0);
                areaEffect.subEffectID        = reader.GetInt(row, (int)Column_Area.COL_SUBEFFECTID, 0);
                areaEffect.posBindBone        = reader.GetString(row, (int)Column_Area.COL_POSBINDBONE, "");

                string[] customOffStrArry = reader.GetString(row, (int)Column_Area.COL_CUSTOMOFFSET, "").Split(';');
                areaEffect.customOffset = StrArry2Vector3(customOffStrArry);

                areaEffect.projectOnGround     = reader.GetInt(row, (int)Column_Area.COL_PROJONGROUND, 0) > 0 ? true : false;
                areaEffect.extentToMaxDistance = reader.GetInt(row, (int)Column_Area.COL_EXTENTTOMAXDIS, 0) > 0 ? true : false;
                areaEffect.effectCount         = reader.GetInt(row, (int)Column_Area.COL_EFFECTCOUNT, 0);
                areaEffect.effectTotalTick     = reader.GetInt(row, (int)Column_Area.COL_EFFECTTOTALTICK, 0);

                AddLightEffect(areaEffect);
            }
            break;

            case (int)LightingEffectConfigType.Camera:
            {
                LightingEffect_Camera camEffect = ScriptableObject.CreateInstance <LightingEffect_Camera>();
                FillBaseData(camEffect, reader, row);

                int animOrgPos = reader.GetInt(row, (int)Column_Camera.COL_ANIMORGPOS, 0);
                if (Enum.IsDefined(typeof(Effect.CameraAnimOrgType), animOrgPos))
                {
                    camEffect.animationOrgPos = (Effect.CameraAnimOrgType)animOrgPos;
                }

                camEffect.animationOrgProjectFloor = reader.GetInt(row, (int)Column_Camera.COL_ANIMORGPROJFLOOR, 0) > 0 ? true : false;
                camEffect.animationMainCamera      = reader.GetInt(row, (int)Column_Camera.COL_ANIMMAINCAM, 0) > 0 ? true : false;

                int attackType = reader.GetInt(row, (int)Column_Camera.COL_ATTACKTYPE, 0);
                if (Enum.IsDefined(typeof(Effect.EffectAttackType), attackType))
                {
                    camEffect.attackType = (Effect.EffectAttackType)attackType;
                }

                camEffect.effectRad        = reader.GetFloat(row, (int)Column_Camera.COL_EFFECTRAD, 0f);
                camEffect.effectLiveTick   = reader.GetInt(row, (int)Column_Camera.COL_EFFECTLIVETICK, 0);
                camEffect.delayTick        = reader.GetInt(row, (int)Column_Camera.COL_DELAYTICK, 0);
                camEffect.effectFinishTick = reader.GetInt(row, (int)Column_Camera.COL_EFFECTFINISHTICK, 0);
                camEffect.recoverTransform = reader.GetInt(row, (int)Column_Camera.RECOVERTRANSFORM, 0) > 0 ? true : false;

                AddLightEffect(camEffect);
            }
            break;

            case (int)LightingEffectConfigType.Shadow:
            {
                LightingEffect_Shadow shadowEffect = ScriptableObject.CreateInstance <LightingEffect_Shadow>();
                FillBaseData(shadowEffect, reader, row);

                shadowEffect.nStartTick          = reader.GetInt(row, (int)Column_Shadow.COL_STARTTICK, 0);
                shadowEffect.nEndTick            = reader.GetInt(row, (int)Column_Shadow.COL_ENDTICK, 0);
                shadowEffect.fStartAlpha         = reader.GetFloat(row, (int)Column_Shadow.COL_STARTALPHA, 0);
                shadowEffect.nShadowMaintainTick = reader.GetInt(row, (int)Column_Shadow.COL_MAINTAINTICK, 0);
                shadowEffect.nShadowFadeoutTick  = reader.GetInt(row, (int)Column_Shadow.COL_FADEOUTTICK, 0);
                shadowEffect.shadowIntervalTicks = reader.GetInt(row, (int)Column_Shadow.COL_INTERVTICK, 0);

                string[] frameStrArry = reader.GetString(row, (int)Column_Shadow.COL_FRAMETICK, "").Split(';');
                int[]    frameIntArry = new int[frameStrArry.Length];
                for (int i = 0; i < frameStrArry.Length; i++)
                {
                    int.TryParse(frameStrArry[i], out frameIntArry[i]);
                }
                shadowEffect.shadowFrameTicks = frameIntArry;

                shadowEffect.alphaAttributeName = reader.GetString(row, (int)Column_Shadow.COL_ALPHAATTNAME, "");

                shadowEffect.DisableWeapon = reader.GetInt(row, (int)Column_Shadow.COL_DISABLEWEAPON, 0) > 0 ? true : false;

                int attrType = reader.GetInt(row, (int)Column_Shadow.COL_ALPHAATTTYPE, 0);
                if (Enum.IsDefined(typeof(LightingEffect_Shadow.AlphaAttributeType), attrType))
                {
                    shadowEffect.alphaAttributeType = (LightingEffect_Shadow.AlphaAttributeType)attrType;
                }

                shadowEffect.minDistance = reader.GetFloat(row, (int)Column_Shadow.COL_MINDISTANCE, 0);

                AddLightEffect(shadowEffect);
            }
            break;

            case (int)LightingEffectConfigType.Sound:
            {
                LightingEffect_Sound soundEffect = ScriptableObject.CreateInstance <LightingEffect_Sound>();
                FillBaseData(soundEffect, reader, row);

                soundEffect.soundID = reader.GetInt(row, (int)Column_Sound.COL_SOUND, 0);

                AddLightEffect(soundEffect);
            }
            break;

            case (int)LightingEffectConfigType.Speed:
            {
                LightingEffect_Speed speedEffect = ScriptableObject.CreateInstance <LightingEffect_Speed>();
                FillBaseData(speedEffect, reader, row);

                speedEffect.nStartTick    = reader.GetInt(row, (int)Column_Speed.COL_STARTTICK, 0);
                speedEffect.nEndTick      = reader.GetInt(row, (int)Column_Speed.COL_ENDTICK, 0);
                speedEffect.globalSpeed   = reader.GetFloat(row, (int)Column_Speed.COL_GLOBALSPEED, 0);
                speedEffect.animatorSpeed = reader.GetFloat(row, (int)Column_Speed.COL_ANIMSPEED, 0);
                speedEffect.effectRad     = reader.GetFloat(row, (int)Column_Speed.COL_EFFECTRAD, 0);

                AddLightEffect(speedEffect);
            }
            break;

            case (int)LightingEffectConfigType.Ward:
            {
                LightingEffect_Ward wardEffect = ScriptableObject.CreateInstance <LightingEffect_Ward>();
                FillBaseData(wardEffect, reader, row);

                wardEffect.nStartTick       = reader.GetInt(row, (int)Column_Ward.COL_STARTTICK, 0);
                wardEffect.nEndTick         = reader.GetInt(row, (int)Column_Ward.COL_ENDTICK, 0);
                wardEffect.blockAllCreature = reader.GetInt(row, (int)Column_Ward.COL_BLOCKALLCREATURE, 0) > 0 ? true : false;

                AddLightEffect(wardEffect);
            }
            break;

            case (int)LightingEffectConfigType.Invalid:
            default:
                break;
            }
        }
Exemple #13
0
        public static void Import()
        {
            int    index  = Application.dataPath.LastIndexOf("/");
            string stPath = Application.dataPath.Substring(0, index) + "/Data/Scp/" + schemeFileName;

            // string stPath = OutConfigPath;
            //if (!File.Exists(stPath))
            //    return;
            ScpReader reader = new ScpReader(stPath, true, 2);

            if (reader == null)
            {
                Trace.LogError("read scheme fail! file = " + stPath);
                return;
            }
            int nRecorderCount = reader.GetRecordCount();

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                if (i > 1)
                {
                    break;
                }
                //
                HeroInfo heroInfo;
                heroInfo.prefabPath = reader.GetString(i, (int)HeroPrefabCsvCouml.PrefabPath, "");
                heroInfo.prefabName = reader.GetString(i, 1, "");
                heroInfo.modelPath  = reader.GetString(i, 2, "");
                GameObject HeroPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(heroInfo.prefabPath);
                if (HeroPrefab == null)
                {
                    Debug.Log("配置导入 , 光效配置导入出错: " + heroInfo.prefabPath + " 预制体不存在");
                    continue;
                }
                heroInfo.Animator            = HeroPrefab.GetComponent <Animator>();
                heroInfo.CharacterController = HeroPrefab.GetComponentInChildren <CharacterController>();
                heroInfo.CreatureProperty    = HeroPrefab.GetComponentInChildren <CreatureProperty>();
                heroInfo.PersonSkinConfig    = HeroPrefab.GetComponentInChildren <PersonSkinConfig>();

                //if (heroInfo.Animator==null)
                //{
                //    string AnimatorPath = reader.GetString(i, 3, "");
                //    RuntimeAnimatorController HeroAnimator = AssetDatabase.LoadAssetAtPath<RuntimeAnimatorController>(AnimatorPath);
                //    if (HeroAnimator!=null)
                //    {
                //        heroInfo.Animator = HeroPrefab.AddComponent<Animator>();
                //        heroInfo.Animator.runtimeAnimatorController = HeroAnimator;
                //    }
                //}
                if (heroInfo.Animator != null)
                {
                    string AnimatorPathOld = AssetDatabase.GetAssetPath(heroInfo.Animator.runtimeAnimatorController);
                    string AnimatorPathNew = reader.GetString(i, 3, "");
                    if (AnimatorPathOld != AnimatorPathNew)
                    {
                        RuntimeAnimatorController HeroAnimator = AssetDatabase.LoadAssetAtPath <RuntimeAnimatorController>(AnimatorPathNew);
                        heroInfo.Animator.runtimeAnimatorController = HeroAnimator;
                    }
                }
                if (heroInfo.CharacterController != null)
                {
                    string str = reader.GetString(i, 4, "");
                    if (str != "null")
                    {
                        float   SlopeLimit      = reader.GetFloat(i, 4, 0);
                        float   StepOffset      = reader.GetFloat(i, 5, 0);
                        float   SkinWidth       = reader.GetFloat(i, 6, 0);
                        float   MinMoveDistance = 0;
                        float   CenterX         = reader.GetFloat(i, 8, 0);
                        float   CenterY         = reader.GetFloat(i, 9, 0);
                        float   CenterZ         = reader.GetFloat(i, 10, 0);
                        Vector3 Center          = new Vector3(CenterX, CenterY, CenterZ);
                        float   Radius          = reader.GetFloat(i, 11, 0);
                        float   Height          = reader.GetFloat(i, 12, 0);

                        heroInfo.CharacterController.slopeLimit = SlopeLimit;
                        heroInfo.CharacterController.stepOffset = StepOffset;
                        heroInfo.CharacterController.skinWidth  = SkinWidth;
                        heroInfo.CharacterController.center     = Center;
                        heroInfo.CharacterController.radius     = Radius;
                        heroInfo.CharacterController.height     = Height;
                    }
                }
                if (heroInfo.CreatureProperty != null)
                {
                    string str = reader.GetString(i, 13, "");
                    if (str != "null")
                    {
                        float      FloatingMinHeight       = reader.GetFloat(i, 13, 0);
                        float      AimDistance             = reader.GetFloat(i, 14, 0);
                        float      LockAimDistance         = reader.GetFloat(i, 15, 0);
                        float      AttackedAimDistance     = reader.GetFloat(i, 16, 0);
                        float      AttackMoveRange         = reader.GetFloat(i, 17, 0);
                        float      MaxAttackMoveSpeedScale = reader.GetFloat(i, 18, 0);
                        int        CommonAttackSkillID     = reader.GetInt(i, 19, 0);
                        float      AnimatorCrossSpeed      = reader.GetFloat(i, 20, 0);
                        bool       FPSMode = reader.GetInt(i, 21, 0) == 1 ? true : false;
                        float      TopInfoHideInDistance = reader.GetFloat(i, 22, 0);
                        float      BloodYOffset          = reader.GetFloat(i, 23, 0);
                        float      TopNameYOffset        = reader.GetFloat(i, 24, 0);
                        string[]   CrossHairOffsetStr    = reader.GetString(i, 25, "").Split(';');
                        Vector2    CrossHairOffset       = new Vector2(float.Parse(CrossHairOffsetStr[0]), float.Parse(CrossHairOffsetStr[1]));
                        bool       CrossHairVisible      = reader.GetInt(i, 26, 0) == 1 ? true : false;
                        bool       MouseAim               = reader.GetInt(i, 27, 0) == 1 ? true : false;
                        bool       CheckPosition          = reader.GetInt(i, 28, 0) == 1 ? true : false;
                        float      CreatureHeightInMeters = reader.GetFloat(i, 29, 0);
                        GameObject ScreenCastObject       = null /*reader.GetFloat(i, 30, 0)*/;
                        Vector3    CreatureBoundingRad    = new Vector3(reader.GetFloat(i, 31, 0), reader.GetFloat(i, 32, 0), reader.GetFloat(i, 33, 0));
                        float      InertiaAcceleration    = reader.GetFloat(i, 34, 0);
                        float      InertiaScale           = reader.GetFloat(i, 35, 0);

                        heroInfo.CreatureProperty.floatingMinHeight       = FloatingMinHeight;
                        heroInfo.CreatureProperty.aimDistance             = AimDistance;
                        heroInfo.CreatureProperty.lockAimDistance         = LockAimDistance;
                        heroInfo.CreatureProperty.attackedAimDistance     = AttackedAimDistance;
                        heroInfo.CreatureProperty.attackMoveRange         = AttackMoveRange;
                        heroInfo.CreatureProperty.maxAttackMoveSpeedScale = MaxAttackMoveSpeedScale;
                        heroInfo.CreatureProperty.commonAttackSkillID     = CommonAttackSkillID;
                        heroInfo.CreatureProperty.animatorCrossSpeed      = AnimatorCrossSpeed;
                        heroInfo.CreatureProperty.FPSMode = FPSMode;
                        heroInfo.CreatureProperty.TopInfoHideInDistance = TopInfoHideInDistance;
                        heroInfo.CreatureProperty.BloodYOffset          = BloodYOffset;
                        heroInfo.CreatureProperty.TopNameYOffset        = TopNameYOffset;
                        heroInfo.CreatureProperty.CrossHairOffset       = CrossHairOffset;
                        heroInfo.CreatureProperty.CrossHairVisible      = CrossHairVisible;
                        heroInfo.CreatureProperty.MouseAim               = MouseAim;
                        heroInfo.CreatureProperty.checkPosition          = CheckPosition;
                        heroInfo.CreatureProperty.CreatureHeightInMeters = CreatureHeightInMeters;
                        heroInfo.CreatureProperty.ScreenCastObject       = ScreenCastObject;
                        heroInfo.CreatureProperty.CreatureBoundingRad    = CreatureBoundingRad;
                        heroInfo.CreatureProperty.InertiaAcceleration    = InertiaAcceleration;
                        heroInfo.CreatureProperty.InertiaScale           = InertiaScale;
                    }
                }
                if (heroInfo.PersonSkinConfig != null)
                {
                    Renderer  rightweapon           = GetComponentFromPath <Renderer>(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.RightWeapon, ""));
                    Renderer  leftweapon            = GetComponentFromPath <Renderer>(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.LeftWeapon, ""));
                    Renderer  body                  = GetComponentFromPath <Renderer>(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.Body, ""));
                    Renderer  backBody              = GetComponentFromPath <Renderer>(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.BackBody, ""));
                    Transform chibangguadian        = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.chibangguadian, ""));
                    float     OptimitzedDistance    = reader.GetFloat(i, (int)HeroPrefabCsvCouml.OptimitzedDistance, 0);
                    int       CacheCout             = reader.GetInt(i, (int)HeroPrefabCsvCouml.CacheCout, 0);
                    bool      OptimizedNearMainHero = reader.GetInt(i, (int)HeroPrefabCsvCouml.OptimizedNearMainHero, 0) == 1 ? true : false;

                    Transform Main       = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.Main, ""));
                    Transform Root_M     = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.Root_M, ""));
                    Transform BackA_M    = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.BackA_M, ""));
                    Transform Root_MCopy = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.Root_MCopy, ""));

                    Transform weaponObject  = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.weaponObject, ""));
                    Transform weaponObject2 = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.weaponObject2, ""));

                    bool    adjustSpine         = reader.GetInt(i, (int)HeroPrefabCsvCouml.adjustSpine, 0) == 1 ? true : false;
                    bool    RootAReplace        = reader.GetInt(i, (int)HeroPrefabCsvCouml.RootAReplace, 0) == 1 ? true : false;
                    int     AttackAnimatorLayer = reader.GetInt(i, (int)HeroPrefabCsvCouml.AttackAnimatorLayer, 0);
                    Vector3 rootAngleWithAim    = new Vector3(
                        reader.GetInt(i, (int)HeroPrefabCsvCouml.rootAngleWithAimX, 0),
                        reader.GetInt(i, (int)HeroPrefabCsvCouml.rootAngleWithAimY, 0),
                        reader.GetInt(i, (int)HeroPrefabCsvCouml.rootAngleWithAimZ, 0)
                        );
                    bool       progressWeight     = reader.GetInt(i, (int)HeroPrefabCsvCouml.progressWeight, 0) == 1 ? true : false;
                    float      lookAngleScale     = reader.GetFloat(i, (int)HeroPrefabCsvCouml.lookAngleScale, 0);
                    Transform  lookRefTransform   = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.lookRefTransform, ""));
                    Transform  ScreenCastObjectTr = GetTransformFromPath(HeroPrefab.transform, reader.GetString(i, (int)HeroPrefabCsvCouml.ScreenCastObject2, ""));
                    GameObject ScreenCastObject   = ScreenCastObjectTr == null ? null : ScreenCastObjectTr.gameObject;
                    int        jumpDeltyTick      = reader.GetInt(i, (int)HeroPrefabCsvCouml.jumpDeltyTick, 0);
                    float      maxFallSpeed       = reader.GetFloat(i, (int)HeroPrefabCsvCouml.maxFallSpeed, 0);
                    bool       MorphHip           = reader.GetInt(i, (int)HeroPrefabCsvCouml.MorphHip, 0) == 1 ? true : false;


                    heroInfo.PersonSkinConfig.RightWeaponRender     = rightweapon;
                    heroInfo.PersonSkinConfig.LeftWeaponRender      = leftweapon;
                    heroInfo.PersonSkinConfig.BodyRender            = body;
                    heroInfo.PersonSkinConfig.BackBodyRender        = backBody;
                    heroInfo.PersonSkinConfig.chibangguadian        = chibangguadian;
                    heroInfo.PersonSkinConfig.OptimitzedDistance    = OptimitzedDistance;
                    heroInfo.PersonSkinConfig.CacheCout             = CacheCout;
                    heroInfo.PersonSkinConfig.OptimizedNearMainHero = OptimizedNearMainHero;

                    heroInfo.PersonSkinConfig.Main                = Main;
                    heroInfo.PersonSkinConfig.Root_M              = Root_M;
                    heroInfo.PersonSkinConfig.BackA_M             = BackA_M;
                    heroInfo.PersonSkinConfig.Root_MCopy          = Root_MCopy;
                    heroInfo.PersonSkinConfig.weaponObject        = weaponObject;
                    heroInfo.PersonSkinConfig.weaponObject2       = weaponObject2;
                    heroInfo.PersonSkinConfig.adjustSpine         = adjustSpine;
                    heroInfo.PersonSkinConfig.RootAReplace        = RootAReplace;
                    heroInfo.PersonSkinConfig.AttackAnimatorLayer = AttackAnimatorLayer;
                    heroInfo.PersonSkinConfig.rootAngleWithAim    = rootAngleWithAim;
                    heroInfo.PersonSkinConfig.progressWeight      = progressWeight;
                    heroInfo.PersonSkinConfig.lookAngleScale      = lookAngleScale;
                    heroInfo.PersonSkinConfig.lookRefTransform    = lookRefTransform;
                    heroInfo.PersonSkinConfig.ScreenCastObject    = ScreenCastObject;
                    heroInfo.PersonSkinConfig.jumpDeltyTick       = jumpDeltyTick;
                    heroInfo.PersonSkinConfig.maxFallSpeed        = maxFallSpeed;
                    heroInfo.PersonSkinConfig.MorphHip            = MorphHip;
                }
            }
        }
Exemple #14
0
    /// <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);
    }