Merge branch 'master_develop' of http://60.1.1.230/gaoxin/JL_Client into master_develop

dev_chengFeng
jl_ios 2020-08-11 14:05:49 +08:00
commit ab6be0a9e2
48 changed files with 334 additions and 230 deletions

View File

@ -0,0 +1 @@
{"subChannel":"888", "buglyId":"b67b061643", "channel":"pc", "resUrl":"http://cdn-jl.lanjingshidai.com/banshu/", "packageVersion":"0.1", "version":"0.1.1", "serverUrl":"http://154.8.225.157:8080/"}

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 44e8f8c35f8874042a8856c45b185457
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: a0c8cd122c8e7be48be5d7d9984eaa7d
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 896a3366a6ab7d140850d34bf1860504
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 3fd7c7e0c43026441be04fc350c66a78
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 9cebf67f0c4a28a4787608131d222ab2
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 5b5220f537cf91e48a16941aceaed623
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 636d05a406b746245a9fa5f9147d5278
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 01112efd396993249b8f1a1261cee635
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 565d3e0d570afc541b95e45b361e848f
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 54bed607bff1ae945874063f1ef4501c
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,6 +10,7 @@ this.mapShotTimeItemData = {}
this.tianFuMaterial = {}
this.needEndingTime = 0
this.dropIsSHowEquipPrint = true--显示掉落时是否显示装备和魂印
function this.Initialize()
this.isBagPanel = false
end
@ -703,7 +704,12 @@ function this.GetItemListFromTempBag(drop, isSave)
itemdata.frame = GetQuantityImageByquality(itemdata.configData.Quantity)
itemdata.icon = GetResourcePath(itemdata.configData.ResourceID)
itemdata.num = drop.itemlist[i].itemNum
table.insert(itemDataList, itemdata)
-- LogGreen("itemdata.configData.ItemType "..itemdata.configData.ItemType.." this.dropIsSHowEquipPrint "..tostring(this.dropIsSHowEquipPrint))
if itemdata.configData.ItemType ~= ItemType.Equip or itemdata.configData.ItemType ~= ItemType.HunYin then
table.insert(itemDataList, itemdata)
elseif this.dropIsSHowEquipPrint then--献祭 升星吞卡 掉落身上装备和魂印 但是不显示 前端做处理
table.insert(itemDataList, itemdata)
end
end
end
if drop.equipId ~= nil and #drop.equipId > 0 then
@ -992,4 +998,8 @@ function this.BagIndicationRefresh(msg)
CheckRedPointStatus(RedPointType.Bag_HeroDebris)
CheckRedPointStatus(RedPointType.Bag_BoxAndBlueprint)
end
function this.SetDropIsSHowEquipPrint(dropIsSHowEquipPrint)
this.dropIsSHowEquipPrint = dropIsSHowEquipPrint
end
return this

View File

@ -3235,9 +3235,9 @@ local passivityList = {
local af = 0
local onSkillCast = function(skill)
local targets = skill:GetDirectTargets()
if targets and #targets > 0 then
af = BattleUtil.ErrorCorrection(f1/#targets)
local maxNum = skill:GetMaxTargetNum()
if maxNum and maxNum > 0 then
af = BattleUtil.ErrorCorrection(f1/maxNum)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
@ -3309,9 +3309,9 @@ local passivityList = {
local af = 0
local onSkillCast = function(skill)
local targets = skill.effectTargets[2]
if targets and #targets > 0 then
af = BattleUtil.ErrorCorrection(f1/#targets)
local maxNum = skill:GetMaxTargetNum()
if maxNum and maxNum > 0 then
af = BattleUtil.ErrorCorrection(f1/maxNum)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
@ -3365,9 +3365,9 @@ local passivityList = {
local af = 0
local onSkillCast = function(skill)
local targets = skill:GetDirectTargets()
if targets and #targets > 0 then
af = BattleUtil.ErrorCorrection(f1/#targets)
local maxNum = skill:GetMaxTargetNum()
if maxNum and maxNum > 0 then
af = BattleUtil.ErrorCorrection(f1/maxNum)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
@ -3436,9 +3436,9 @@ local passivityList = {
local af = 0
local onSkillCast = function(skill)
local targets = skill:GetDirectTargets()
if targets and #targets > 0 then
af = BattleUtil.ErrorCorrection(f1/#targets)
local maxNum = skill:GetMaxTargetNum()
if maxNum and maxNum > 0 then
af = BattleUtil.ErrorCorrection(f1/maxNum)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
@ -3714,15 +3714,24 @@ local passivityList = {
local f1 = args[1]
local OnRoleDamageBefore = function(defRole, factorFunc, damageType, skill)
local targets = skill:GetDirectTargets()
if not targets or #targets == 0 then return end
local cf = f1/#targets
for _, target in ipairs(targets) do
BattleUtil.RandomAction(cf, function()
BattleLogic.BuffMgr:ClearBuff(target, function(buff)
return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
if skill then
-- 计算概率
local cf = f1
local maxNum = skill:GetMaxTargetNum()
if maxNum and maxNum > 0 then
cf = cf/maxNum
end
local targets = skill:GetDirectTargets()
if not targets or #targets == 0 then return end
for _, target in ipairs(targets) do
BattleUtil.RandomAction(cf, function()
BattleLogic.BuffMgr:ClearBuff(target, function(buff)
return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
end)
end)
end)
end
end
end
role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)

View File

@ -1,4 +1,4 @@
RoleLogic = {}
RoleLogic = {}
RoleLogic.__index = RoleLogic
--local RoleLogic = RoleLogic
--local RoleDataName = RoleDataName
@ -161,6 +161,12 @@ end
-- 改变怒气值
function RoleLogic:AddRage(value, type)
-- 角色身上有无敌盾,不扣除怒气 by:wangzhenxing 2020/08/10 14:56
if (type==3 or type==4) and BattleLogic.BuffMgr:HasBuff(self, BuffName.Shield, function (buff) return buff.shieldType and buff.shieldType == ShieldTypeName.AllReduce end) then
LogError("角色身上有无敌盾,不扣除怒气")
return
end
local delta = 0
if type == 1 then --加算
delta = value

View File

@ -1,4 +1,4 @@
HeroManager = {}
HeroManager = {}
local this = HeroManager
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
@ -915,57 +915,59 @@ local function CalculateHeroUpTalismanProAddVal(_heroId, _breakId, _upStarId,tea
end
--英雄身上魂印属性计算
local function CalculateSoulPrintAddVal(_heroId)
local allSoulPrintAddWarPowerVal = 0
-- local allSoulPrintAddWarPowerVal = 0
-- local curHeroData = HeroManager.GetSingleHeroData(_heroId)
-- if curHeroData then
-- if (table.nums(curHeroData.soulPrintList) >= 1) then
-- for i = 1, #curHeroData.soulPrintList do
-- LogError(_heroId)
-- local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId]
-- if cursoulPrintConfig then
-- allSoulPrintAddWarPowerVal = allSoulPrintAddWarPowerVal + cursoulPrintConfig.Score
-- end
-- end
-- end
-- end
-- return allSoulPrintAddWarPowerVal
local addAllProVal = {}
local singleHeroProVal,lvProVal,allHeroProVal,specialProVal
local curHeroData = HeroManager.GetSingleHeroData(_heroId)
if curHeroData then
if (table.nums(curHeroData.soulPrintList) >= 1) then
for i = 1, #curHeroData.soulPrintList do
local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId]
if cursoulPrintConfig then
allSoulPrintAddWarPowerVal = allSoulPrintAddWarPowerVal + cursoulPrintConfig.Score
end
end
end
if(table.nums(curHeroData.soulPrintList) >= 1) then
for i = 1, #curHeroData.soulPrintList do
local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId]
if cursoulPrintConfig then
--基础属性计算
local soulPrintPropertyList = cursoulPrintConfig.Property
if soulPrintPropertyList and #soulPrintPropertyList > 0 then
for i,v in pairs(soulPrintPropertyList) do
if(addAllProVal[v[1]]) then
addAllProVal[v[1]]=v[2]+addAllProVal[v[1]]
else
addAllProVal[v[1]]=v[2]
end
end
end
--被动技能计算
if cursoulPrintConfig.PassiveSkill then
--单体加成 --单体等级限制加成 --团体加成 --减乘
singleHeroProVal,lvProVal,allHeroProVal,specialProVal = this.CalculatePassiveSkillsValList(WarPowerType.SoulPrint,cursoulPrintConfig.PassiveSkill)
end
end
end
end
end
return allSoulPrintAddWarPowerVal
--local addAllProVal = {}
--local singleHeroProVal,lvProVal,allHeroProVal,specialProVal
--local curHeroData = HeroManager.GetSingleHeroData(_heroId)
--if curHeroData then
-- if(table.nums(curHeroData.soulPrintList) >= 1) then
-- for i = 1, #curHeroData.soulPrintList do
-- local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId]
-- if cursoulPrintConfig then
-- --基础属性计算
-- local soulPrintPropertyList = cursoulPrintConfig.Property
-- if soulPrintPropertyList and #soulPrintPropertyList > 0 then
-- for i,v in pairs(soulPrintPropertyList) do
-- if(addAllProVal[v[1]]) then
-- addAllProVal[v[1]]=v[2]+addAllProVal[v[1]]
-- else
-- addAllProVal[v[1]]=v[2]
-- end
-- end
-- end
-- --被动技能计算
-- if cursoulPrintConfig.PassiveSkill then
-- --单体加成 --单体等级限制加成 --团体加成 --减乘
-- singleHeroProVal,lvProVal,allHeroProVal,specialProVal = this.CalculatePassiveSkillsValList(WarPowerType.SoulPrint,cursoulPrintConfig.PassiveSkill)
-- end
-- end
-- end
-- end
--end
--if singleHeroProVal and LengthOfTable(singleHeroProVal) > 0 then
-- for i,v in pairs(singleHeroProVal) do
-- if addAllProVal[i] then
-- addAllProVal[i] = addAllProVal[i] + v
-- else
-- addAllProVal[i] = v
-- end
-- end
--end
--return addAllProVal,lvProVal,allHeroProVal,specialProVal
if singleHeroProVal and LengthOfTable(singleHeroProVal) > 0 then
for i,v in pairs(singleHeroProVal) do
if addAllProVal[i] then
addAllProVal[i] = addAllProVal[i] + v
else
addAllProVal[i] = v
end
end
end
return addAllProVal,lvProVal,allHeroProVal,specialProVal
end
--英雄身上宝器属性计算
local function CalculateEquipTreaSureAddVal(_heroId)
@ -1434,10 +1436,10 @@ function this.GetAllHeroTeamAddProVal(teamHeroInfos,curteamHeroDid)
CalculateHeroPassiveSkillProAddVal(1, teamHeroInfos[i].heroId,nil,nil, curteamHeroDid and HeroManager.GetSingleHeroData(curteamHeroDid).heroConfig.PropertyName or nil)
local falismanSingleHeroProVal, falismanLvProVal, falismanAllHeroProVal, falismanSpecialProVal =
CalculateHeroUpTalismanProAddVal(teamHeroInfos[i].heroId,nil,nil, curteamHeroDid and HeroManager.GetSingleHeroData(curteamHeroDid).heroConfig.PropertyName or nil)
--local soulPrinSingleHeroProVal,soulPrinLvProVal,soulPrinAllHeroProVal,soulPrinSpecialProVal = CalculateSoulPrintAddVal(teamHeroInfos[i].heroId)
local soulPrinSingleHeroProVal,soulPrinLvProVal,soulPrinAllHeroProVal,soulPrinSpecialProVal = CalculateSoulPrintAddVal(teamHeroInfos[i].heroId)
this.DoubleTableCompound(teamProVal, heroSkillAllHeroProVal)
this.DoubleTableCompound(teamProVal, falismanAllHeroProVal)
--this.DoubleTableCompound(teamProVal,soulPrinAllHeroProVal)
this.DoubleTableCompound(teamProVal,soulPrinAllHeroProVal)
end
end
--光环加成
@ -1556,7 +1558,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt
-- end
--end
--魂印的属性加成
local allSoulPrintAddWarPowerVal = CalculateSoulPrintAddVal(curHeroData.dynamicId)
local singleHeroSoulPrintProVal,lvSoulPrintProVal,allHeroSoulPrintProVal,specialSoulPrintProVal = CalculateSoulPrintAddVal(curHeroData.dynamicId)
-- LogError("魂印的单体属性加成 "..allSoulPrintAddWarPowerVal)
--宝器加成 宝器本身属性 + 宝器激活的强化共鸣 和 精炼共鸣
local equipTreasureAddPro = CalculateEquipTreaSureAddVal(curHeroData.dynamicId)
@ -1600,19 +1602,19 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt
this.DoubleTableCompound(allAddProVal, allPokemonPeiJianAddPro)
this.DoubleTableCompound(allAddProVal, guildSkillAllProAdd)
this.DoubleTableCompound(allAddProVal, falismanSingleHeroProVal)
--this.DoubleTableCompound(allAddProVal,soulPrinSingleHeroProVal)
this.DoubleTableCompound(allAddProVal,singleHeroSoulPrintProVal)
this.DoubleTableCompound(allAddProVal, playerDcorateAdd)
this.DoubleTableCompound(allAddProVal, heroSkillSingleHeroProVal)
this.DoubleTableCompound(allAddProVal, equipTreasureAddPro)
this.DoubleTableCompound(allAddProVal, vipAddPro)
--100等级所有属性合并
this.DoubleTableCompound(lvProVal, falismanLvProVal)
--this.DoubleTableCompound(lvProVal,soulPrinLvProVal)
this.DoubleTableCompound(lvProVal,lvSoulPrintProVal)
this.DoubleTableCompound(lvProVal, heroSkillLvProVal)
--团体所有属性合并
if not _isAllHeroProVal then
this.DoubleTableCompound(allHeroProVal, falismanAllHeroProVal)
--this.DoubleTableCompound(allHeroProVal,soulPrinAllHeroProVal)
this.DoubleTableCompound(allHeroProVal,allHeroSoulPrintProVal)
this.DoubleTableCompound(allHeroProVal, heroSkillAllHeroProVal)
this.DoubleTableCompound(allHeroProVal, teamAddPro)
end
@ -1623,7 +1625,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt
-- end
--4公式特殊减乘所有属性加成
this.DoubleTableCompound(specialProVal, falismanSpecialProVal)
--this.DoubleTableCompound(specialProVal,soulPrinSpecialProVal)
this.DoubleTableCompound(specialProVal,specialSoulPrintProVal)
this.DoubleTableCompound(specialProVal, heroSkillSpecialProVal)
--100等级所有属性合并
local forNum = curLvNum - 100
@ -1739,10 +1741,10 @@ curHeroData.MLSproList={}
if _type == 1 then
--最后加魂印战力
allAddProVal[HeroProType.WarPower] =
allEquipScore + CalculateWarForce(allAddProVal) + allSoulPrintAddWarPowerVal
allEquipScore + CalculateWarForce(allAddProVal)
elseif _type == 2 then
allAddProVal[HeroProType.WarPower] =
allEquipScore + CalculateWarForce(allAddProVal) + allSoulPrintAddWarPowerVal
allEquipScore + CalculateWarForce(allAddProVal)
--最后加魂印战力
end
--for i, v in pairs(allAddProVal) do

View File

@ -463,7 +463,7 @@ function RewardItemPopup:ItemDataListSort(itemDataList)
end
--界面关闭时调用(用于子类重写)
function RewardItemPopup:OnClose()
BagManager.SetDropIsSHowEquipPrint(true)
local fightConFigData = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, FightPointPassManager.curOpenFight)
if compShowType == 1 then
compShowType = 0

View File

@ -36,6 +36,7 @@ function this:BindEvent()
NetManager.UseAndPriceItemRequest(3, data, function(msg)
HeroManager.DeleteHeroDatas(data)
parent:ClosePanel()
BagManager.SetDropIsSHowEquipPrint(false)
UIManager.OpenPanel(UIName.RewardItemPopup,msg,1,function ()
ResolvePanel.SwitchView(2)
end)

View File

@ -1278,6 +1278,7 @@ function RoleInfoPanel:StarUpClick()
UIManager.OpenPanel(UIName.RoleUpStarSuccessPanel,curHeroData,upStarRankUpConfig.Id,upStarRankUpConfig.OpenLevel,function ()
local dropItemTabs = BagManager.GetTableByBackDropData(msg)
if #dropItemTabs > 0 then
BagManager.SetDropIsSHowEquipPrint(false)
UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1, function ()
self:DeleteUpStarMaterials()
end)

View File

@ -1,263 +1,117 @@

using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text;
/// <summary>
/// 这个是讲lua文件转化为UTF-8格式的工具
/// </summary>
public class SetLuaToUTF8 : EditorWindow
{
// 常量 //
// 常量 //
private const string EDITOR_VERSION = "v0.01"; // 这个编辑器的版本号 //
// gui 相关 //
private Vector2 m_scrollPos; // 记录 gui 界面的滚动 //
private string m_luaPath = "ManagedResources/~Lua/"; // 文件路径
private string m_fileSuffix = ".lua"; // 文件后缀
/// <summary>
/// 数据目录
/// </summary>
static string AppDataPath
{
get { return Application.dataPath.ToLower(); }
}
[MenuItem("Lua/File to UTF-8 Encoding")]
static void Init()
{
Debug.Log("初始化转化lua文件为UTF-8格式");
// Get existing open window or if none, make a new one:
SetLuaToUTF8 window = (SetLuaToUTF8)EditorWindow.GetWindow(typeof(SetLuaToUTF8));
}
// UI 按钮显示 //
void OnGUI()
{
m_scrollPos = GUILayout.BeginScrollView(m_scrollPos, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height));
GUILayout.BeginVertical(); // begin
//-------------- 调试按钮 --------------//
// 导出 UI 路径 //
GUILayout.Label("===========================");
GUILayout.BeginHorizontal();
GUILayout.Label("要转化的路径: "); //
m_luaPath = GUILayout.TextField(m_luaPath, 64);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("文件后缀: "); //
m_fileSuffix = GUILayout.TextField(m_fileSuffix, 64);
GUILayout.EndHorizontal();
if (GUILayout.Button("\n 文件转utf-8格式 \n")) //
{
this.Conversion();
}
//-------------- end 调试按钮 --------------//
GUILayout.Space(5);
GUILayout.Label("工具版本号: " + EDITOR_VERSION); //
GUILayout.EndVertical(); // end
GUILayout.EndScrollView();
}
// 开始转化
private void Conversion()
{
if (m_luaPath.Equals(string.Empty))
{
return;
}
if (!IsFolderExists(m_luaPath))
{
Debug.LogError("找不到文件夹路径!");
return;
}
string path = AppDataPath + "/" + m_luaPath;
string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
foreach (string file in files)
{
if (!file.EndsWith(m_fileSuffix)) continue;
if (!file.EndsWith(m_fileSuffix)) continue;
string strTempPath = file.Replace(@"\", "/");
Debug.Log("文件路径:" + strTempPath);
ConvertFileEncoding(strTempPath, null, new UTF8Encoding(false));
}
AssetDatabase.Refresh();
Debug.Log("格式转换完成!");
}
/// 检测是否存在文件夹
private static bool IsFolderExists(string folderPath)
{
if (folderPath.Equals(string.Empty))
{
return false;
return false;
}
return Directory.Exists(GetFullPath(folderPath));
}
/// 返回Application.dataPath下完整目录
private static string GetFullPath(string srcName)
{
if (srcName.Equals(string.Empty))
{
return Application.dataPath;
}
if (srcName[0].Equals('/'))
{
srcName.Remove(0, 1);
}
return Application.dataPath + "/" + srcName;
}
/// <summary>
/// 文件编码转换
/// </summary>
/// <param name="sourceFile">源文件</param>
/// <param name="destFile">目标文件,如果为空,则覆盖源文件</param>
/// <param name="targetEncoding">目标编码</param>
private static void ConvertFileEncoding(string sourceFile, string destFile, Encoding targetEncoding)
{
destFile = string.IsNullOrEmpty(destFile) ? sourceFile : destFile;
File.WriteAllText(destFile, File.ReadAllText(sourceFile, Encoding.UTF8), targetEncoding);
}
}

Binary file not shown.

Binary file not shown.