Files
Main/Assets/GameAssets/Resources/Lua/Main.lua
2025-01-25 04:38:09 +08:00

977 lines
26 KiB
Lua
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

------------------------------------------------
-- 作者: gzg
-- 日期: 2019-03-25
-- 文件: Main.lua
-- 模块: Main
-- 描述: Lua的脚本的启动文件
------------------------------------------------
-- Unity对象操作的函数模块
local L_UnityUtils = require("Common.CustomLib.Utility.UnityUtils");
local Main = {
DeltaTime = 0,
}
-- 主入口函数。从这里开始lua逻辑
function Main.Start(startTime)
print("Lua Main.Start")
if L_UnityUtils.UNITY_EDITOR() then
require("LuaDebug")("localhost", 7003)
end
require("Global.Enum")
Debug = require("Common.CustomLib.Utility.Debug");
---if not L_UnityUtils.UNITY_EDITOR() then
Debug.IsLogging = true
--end
-- 时间相关函数
Time = require("Common.CustomLib.Utility.Time");
Time.Start(startTime);
-- collectgarbage("setpause",200)
-- collectgarbage("setstepmul",5000)
end
-- 1
function Main.RequireGlobalCS()
require("Global.GlobalCS")
end
-- 2
function Main.RequireGlobalLua()
require("Global.GlobalLua")
DataConfig.DataMapsetting:SetIsCache(true)
end
-- 3
function Main.RequireStringDefines()
-- 文字配置(自动生成的,所有配置表的文字对应该表)
StringDefines = DataConfig.Load("StringDefines")
-- DataConfig.LoadAll();
end
-- 核心系统初始化
function Main.CoreInitialize()
GameCenter:CoreInitialize()
end
-- 核心系统卸载
function Main.CoreUninitialize()
GameCenter:CoreUninitialize()
end
-- 逻辑系统初始化
function Main.LogicInitialize(clearLoginData)
GameCenter:LogicInitialize(clearLoginData)
end
-- 逻辑系统卸载
function Main.LogicUninitialize(clearLoginData)
GameCenter:LogicUninitialize(clearLoginData)
end
-- 更新心跳
function Main.Update(deltaTime, realtimeSinceStartup, frameCount)
Time.SetDeltaTime(deltaTime, realtimeSinceStartup, frameCount);
if UnityUtils.IsUseKeyCode() then
KeyCodeSystem.Update(deltaTime)
end
GameCenter:Update(deltaTime)
GameCenter:FrameUpdate(deltaTime)
LuaBehaviourManager:Update(deltaTime)
end
-- 创建ui对应的lua控制脚本c#端调用)
function Main.CreateLuaUIScript(name, gobj)
GameCenter.UIFormManager:CreateLuaUIScript(name, gobj)
end
-- 处理服务器发来的消息
function Main.DoResMessage(msgid, bytes)
GameCenter.Network.DoResMessage(msgid, bytes)
end
-- 获取所有Lua端的消息ID
function Main.GetResLuaMsgIDs()
return GameCenter.Network.GetResLuaMsgIDs()
end
-- 获取所有Lua端扩展的消息ID
function Main.GetResLuaExtendMsgIDs()
return GameCenter.Network.GetResLuaExtendMsgIDs()
end
-- 判断在Lua端是否定义了UI的事件
function Main.HasEvent(eID)
return UILuaEventDefine.HasEvent(eID)
end
-- 判断是否有UIEventDefine在Lua端扩展的某个事件
function Main.HasUIEventExt(eID)
return UIEventExtDefine.HasEvent(eID)
end
-- 窗体关闭时,是否删除ui预制件
function Main.IsDestroyPrefabOnClose()
return AppConfig.IsDestroyPrefabOnClose
end
-- 是否运行分析工具
function Main.IsRuntimeProfiler()
return AppConfig.IsRuntimeProfiler
end
-- 是否记录的耗时写文件
function Main.IsRecordWriteFile()
return AppConfig.IsRecordWriteFile
end
-- 是否收集消耗时间
function Main.IsCollectRecord()
return AppConfig.IsCollectRecord
end
-- 打印配置表加载耗时
function Main.TimeRecordPrint()
CS.Thousandto.Code.Logic.TimeRecord.Print()
end
-- 是否需要重新加载界面
function Main.IsRenewForm(name)
return GameCenter.UIFormManager:IsRenew(name)
end
-- 重新加载界面
function Main.RenewForm(name, paths)
if not GameCenter.UIFormManager then
return
end
GameCenter.UIFormManager:DestroyForm(name)
GameCenter.UIFormManager:AddRenewForm(name)
for i = 0, paths.Length - 1 do
Utils.RemoveRequiredByName(paths[i])
end
end
-- 重新加载逻辑系统
function Main.RenewSystem(name, paths)
GameCenter[string.format("%sSystem", name)] = nil
for i = 0, paths.Length - 1 do
Utils.RemoveRequiredByName(paths[i])
end
GameCenter[string.format("%sSystem", name)] = require(string.format("Logic.%s.%sSystem", name, name))
end
-- 进入场景回调
function Main.OnEnterScene(mapID, isPlane)
-- 通知地图逻辑系统进入场景
if GameCenter.MapLogicSystem ~= nil then
GameCenter.MapLogicSystem:OnEnterScene(mapID, isPlane)
end
end
-- 离开场景回调
function Main.OnLeaveScene(isPlane)
-- 通知地图逻辑系统离开场景
if GameCenter.MapLogicSystem ~= nil then
GameCenter.MapLogicSystem:OnLeaveScene(isPlane)
end
end
-- 获取装备强化等级
function Main.GetStrengthLvByPos(pos)
if GameCenter.LianQiForgeSystem ~= nil then
return GameCenter.LianQiForgeSystem:GetStrengthLvByPos(pos)
end
end
-- 绑定FSM
function Main.BindFSM(Owner)
-- GameCenter.AIManager:Bind(Owner, 1001);
end
-- 解除绑定FSM
function Main.UnBindFSM(Owner)
-- GameCenter.AIManager:UnBind(Owner);
end
-- 判断是否为刘海屏
function Main.IsNotchInScreen()
--local _device = CS.UnityEngine.SystemInfo.deviceModel;
--if _device ~= nil then
-- if string.find(_device, "iPhone10") ~= nil then
-- return true;
--[[
--这里对其他机型进行适配
elseif string.find(_device,"??????") ~= nil then
return true;
]]
-- end
--end
-- 经过查询现有的大厂机型,本身就对流海屏做了适配.
return GameCenter.SDKSystem.SDKImplement:HasNotchInScreen();
end
-- 获取限时购买状态
function Main.GetLimitShopState()
return GameCenter.LimitShopSystem:IsShowEnter()
end
-- 是否有新获得得限时商品
function Main.IsExistNewLimitShop()
return GameCenter.LimitShopSystem:IsExistNewShop()
end
-- 隐藏新限时商品提示
function Main.HideNewLimitShopTips()
GameCenter.PushFixEvent(UILuaEventDefine.UILimitShopTipsForm_CLOSE)
return GameCenter.LimitShopSystem:HideNewShopTips()
end
-- 获取仙盟战玩家阵营状态
function Main.GetXmFightCamp()
return GameCenter.XmFightSystem.Camp
end
-- 返回到登陆选的资源列表
function Main.ToLoginStateNeedAssets()
--[[
None = 0,
VFX = 1,
Role = 2,
Scene = 3,
UITexture = 4,
Atlas = 5,
Font = 6,
Animation = 7,
VFXTexture = 8,//VFX纹理
Form = 9,//窗体
MusicSound = 10,//地图音频
UISound = 11,//UI音频
SpeechSound = 12,//语音音频
SfxSound = 13,//特效音频
AmbientSound = 14,//特效音频
FormAsset = 15,//窗体
]]
return {
{
Type = 4,
AssetName = "tex_logininback_4"
},
{
Type = 4,
AssetName = "tex_logo2"
}
};
end
-- 获取邮件提示数量
function Main.GetMailNumPrompt()
return GameCenter.MailSystem:GetMailNumPrompt()
end
-- 获取未读礼物数量
function Main.GetNotReadPresentCount()
return GameCenter.PresentSystem:GetNotReadPresentCount()
end
-- 通过功能ID的枚举码,来打开相应功能
function Main.DoFunctionCallBack(code, param)
return GameCenter.LuaMainFunctionSystem:DoFunctionCallBack(code, param)
end
-- 显示功能未开启提示
function Main.ShowFuncNotOpenTips(code, param)
return GameCenter.LuaMainFunctionSystem:ShowFuncNotOpenTips(code)
end
-- 功能开启时的回调
function Main.OnFunctionOpened(idCode, isNew)
return GameCenter.LuaMainFunctionSystem:OnFunctionOpened(idCode, isNew)
end
-- 根据配置表id获取背包内有多少个这个id的仙魄
function Main.GetXianPoCountByCfgId(cfgId)
return GameCenter.XianPoSystem:GetXianPoCountByCfgId(cfgId)
end
-- 神兽岛采集物上限
function Main.CrystalIsMax(id)
return GameCenter.SoulMonsterSystem:CrystalIsMax(id);
end
-- 是否显示称号红点
function Main.IsShowTitleRedpoint()
return GameCenter.RoleTitleSystem:ShowRed();
end
-- 当前穿戴的称号id
function Main.GetCurrTitleID()
return GameCenter.RoleTitleSystem:GetCurrTitleID();
end
-- 判断是否有设置坐骑模型
function Main.HasMountId()
return GameCenter.NatureSystem:HasMountId();
end
-- 获得当前穿戴翅膀ID
function Main.GetCurModelId()
return GameCenter.NatureSystem:GetCurModelId();
end
-- 离线经验道具
function Main.AddOnHookTimeItemID()
return GameCenter.OfflineOnHookSystem:AddOnHookTimeItemID();
end
-- 精确到秒
function Main.RemainOnHookTime()
return GameCenter.OfflineOnHookSystem.RemainOnHookTime;
end
-- 获取当前经验药品加成倍率,百分制
function Main.GetCurItemAddRate()
return GameCenter.OfflineOnHookSystem:GetCurItemAddRate();
end
-- 获取当前世界等级
function Main.GetCurWorldLevel()
return GameCenter.OfflineOnHookSystem:GetCurWorldLevel();
end
function Main.GetVariableShowText(pType, curValue, value, simplifyValue)
return GameCenter.LuaVariableSystem:GetVariableShowText(pType, curValue, value, simplifyValue);
end
function Main.GetVariableShowProgress(pType, curValue, value)
return GameCenter.LuaVariableSystem:GetVariableShowProgress(pType, curValue, value);
end
function Main.IsVariableReach(pType, curValue, value)
return GameCenter.LuaVariableSystem:IsVariableReach(pType, curValue, value);
end
function Main.GetVariableValue(code)
return GameCenter.LuaVariableSystem:GetVariableValue(code);
end
function Main.SetXmSupportRedState(isRed)
GameCenter.WorldSupportSystem:SetXmSupportRedState(isRed)
end
function Main.GetXmSupportRedState()
return GameCenter.WorldSupportSystem.RedPoint
end
function Main.GetTeachArray()
return {
GameCenter.ChuanDaoSystem.TeachId,
GameCenter.ChuanDaoSystem.ZhenFaId
}
end
function Main.GetDailyMaxActive()
return GameCenter.DailyActivitySystem.MaxActive
end
function Main.IsRewradGrowthWayFinal()
return GameCenter.GrowthWaySystem:IsRewardFinal()
end
function Main.GetGrowthWayModellID()
return GameCenter.GrowthWaySystem:GetGrowthWayModellID()
end
function Main.GetActiveSwordIdList()
return GameCenter.FlySowardSystem:GetActiveSwordIdList()
end
function Main.OpenLimitShopTipsForm(trans)
GameCenter.LimitShopSystem:HideNewShopTips();
GameCenter.PushFixEvent(UILuaEventDefine.UILimitShopTipsForm_OPEN, trans)
end
function Main.GetAssistPetList()
return GameCenter.PetEquipSystem:GetFightPetList()
end
function Main.GetDressPeralPower(part)
return GameCenter.SoulEquipSystem:GetDressPeralPowerByPart(part)
end
-- 自定义聊天频道排序(随时可以修改)
function Main.GetChatChanelSort()
-- WORLD = 0, //世界
-- GUILD, //帮会 1
-- TEAM, //队伍 2
-- PERSONAL, //私聊 3
-- SYSTEM, //系统 4
-- MINI, //小聊天框,也当做一个频道处理 5
-- PALACE, //王府频道 6
-- ALL, //综合 7
-- CURRENT, //当前 8
-- JOINTEAM, //组队 9
-- Live, //直播 10
-- Friend, //好友 11
-- Experience, //历练、冒险频道 12
-- Cross, //跨服 13
-- ChuanWen, //传闻 14
-- CH = 20, //中文 东南亚新增
-- EN, //英文 东南亚新增
-- TH, //泰文 东南亚新增
local _funcInfo = GameCenter.MainFunctionSystem:GetFunctionInfo(FunctionStartIdCode.CrossChat)
if _funcInfo ~= nil then
if _funcInfo.IsEnable then
return {
4,
14,
2,
1,
0,
13,
9,
8
}
else
return {
4,
14,
2,
1,
0,
9,
8
}
end
end
end
function Main.OpenSkipForm(skipFunc)
if GameCenter.SkipSystem ~= nil then
GameCenter.SkipSystem:OpenSkip(skipFunc)
end
end
function Main.CloseSkipForm()
if GameCenter.SkipSystem ~= nil then
GameCenter.SkipSystem:ForceCloseSkip()
end
end
function Main.CanRewardFreeVip()
return GameCenter.VipSystem.IsGetFreeVipExp
end
function Main.GetJJCLeftTime()
return math.ceil( GameCenter.ArenaShouXiSystem.LeftTime )
end
function Main.CanJoinDaily(id)
return GameCenter.DailyActivitySystem:CanJoinDaily(id)
end
function Main.JoinDaily(id)
return GameCenter.DailyActivitySystem:JoinActivity(id)
end
function Main.GetStringDefinedLength()
return StringDefines.Count
end
function Main.GetStringByStringDefined(id)
return StringDefines[id]
end
--获取到下一提示的数量(-1表示不提示0 可领取, 大于0 显示还差多少等级)
function Main.GetGotoNextCountByLevelGift()
return GameCenter.WelfareSystem.LevelGift:GetGotoNextCount()
end
function Main.GetMeridianAddSkillDic()
return GameCenter.PlayerSkillLuaSystem:GetAddSkillTable()
end
--0:代表获取默认的数据 -1:代表获取已穿戴的 其他值代表获取指定传入id的数据
-- 获取聊天泡泡IconId
function Main.GetChatPaoPaoIconId(id)
local _ret = 0
local _data = nil
if id == -1 then
_data = GameCenter.NewFashionSystem:GetPlayerPaoPaoData()
elseif id == 0 then
_data = GameCenter.NewFashionSystem:GetPlayerPaoPaoDefaultData()
else
_data = GameCenter.NewFashionSystem:GetPlayerPaoPaoDataById(id)
end
if _data ~= nil then
local _occ = GameCenter.GameSceneSystem:GetLocalPlayer().IntOcc
_ret = _data:GetModelId(_occ)
end
return _ret
end
--0:代表获取默认的数据 -1:代表获取已穿戴的 其他值代表获取指定传入id的数据
-- 获取玩家头像IconId
function Main.GetChatHeadIconId(id, occ)
local _ret = 0
local _data = nil
if id == -1 then
_data = GameCenter.NewFashionSystem:GetPlayerHeadData()
elseif id == 0 then
_data = GameCenter.NewFashionSystem:GetPlayerHeadDefaultData()
else
_data = GameCenter.NewFashionSystem:GetPlayerHeadDataById(id)
end
if _data ~= nil then
_ret = _data:GetModelId(occ)
end
return _ret
end
--0:代表获取默认的数据 -1:代表获取已穿戴的 其他值代表获取指定传入id的数据
-- 获取玩家头像框IconId
function Main.GetChatHeadFrameIconId(id)
local _ret = 0
local _data = nil
if id == -1 then
_data = GameCenter.NewFashionSystem:GetPlayerHeadFrameData()
elseif id == 0 then
_data = GameCenter.NewFashionSystem:GetPlayerHeadFrameDefaultData()
else
_data = GameCenter.NewFashionSystem:GetPlayerHeadFrameDataById(id)
end
if _data ~= nil then
local _occ = GameCenter.GameSceneSystem:GetLocalPlayer().IntOcc
_ret = _data:GetModelId(_occ)
end
return _ret
end
function Main.GetDefaultChatPaoPaoCfgId()
local _ret = 0
local _data = nil
_data = GameCenter.NewFashionSystem:GetPlayerPaoPaoDefaultData()
if _data ~= nil then
local _occ = GameCenter.GameSceneSystem:GetLocalPlayer().IntOcc
_ret = _data:GetCfgId()
end
return _ret
end
function Main.GetDefaultChatHeadCfgId()
local _ret = 0
local _data = nil
_data = GameCenter.NewFashionSystem:GetPlayerHeadDefaultData()
if _data ~= nil then
local _occ = GameCenter.GameSceneSystem:GetLocalPlayer().IntOcc
_ret = _data:GetCfgId()
end
return _ret
end
function Main.GetDefaultChatHeadFrameCfgId()
local _ret = 0
local _data = nil
_data = GameCenter.NewFashionSystem:GetPlayerHeadFrameDefaultData()
if _data ~= nil then
local _occ = GameCenter.GameSceneSystem:GetLocalPlayer().IntOcc
_ret = _data:GetCfgId()
end
return _ret
end
-----------------------------------------------
function Main.GetPlayerChatPaoPaoCfgId()
local _ret = 0
local _data = nil
_data = GameCenter.NewFashionSystem:GetPlayerPaoPaoData()
if _data ~= nil then
_ret = _data:GetCfgId()
end
return _ret
end
function Main.GetPlayerChatHeadCfgId()
local _ret = 0
local _data = nil
_data = GameCenter.NewFashionSystem:GetPlayerHeadData()
if _data ~= nil then
_ret = _data:GetCfgId()
end
return _ret
end
function Main.GetPlayerChatHeadFrameCfgId()
local _ret = 0
local _data = nil
_data = GameCenter.NewFashionSystem:GetPlayerHeadFrameData()
if _data ~= nil then
_ret = _data:GetCfgId()
end
return _ret
end
function Main.ReqCommandTargetPos()
if GameCenter.MapLogicSystem.MapCfg and GameCenter.MapLogicSystem.MapCfg.MapLogicType == MapLogicTypeDefine.TerritorialWar then
GameCenter.MapLogicSystem.ActiveLogic:ReqTargetPos()
end
end
function Main.GetCommandFollow()
if GameCenter.MapLogicSystem.MapCfg and GameCenter.MapLogicSystem.MapCfg.MapLogicType == MapLogicTypeDefine.TerritorialWar then
return GameCenter.MapLogicSystem.ActiveLogic.IsFollow
end
return false
end
function Main.GetCommandHasMonster()
if GameCenter.MapLogicSystem.MapCfg and GameCenter.MapLogicSystem.MapCfg.MapLogicType == MapLogicTypeDefine.TerritorialWar then
return GameCenter.MapLogicSystem.ActiveLogic.CurTargetMonsterId == 0
end
return false
end
--展示新物品获取
function Main.AddShowNewItem(reason, itemInst, itemID, addCount)
GameCenter.GetNewItemSystem:AddShowItem(reason, itemInst, itemID, addCount)
end
--展示物品使用
function Main.AddUseNewItem(itemInst, reason, addCount)
GameCenter.GetNewItemSystem:AddShowTips(itemInst, reason, addCount)
end
--打开物品快速获取界面
function Main.OpenItemQuickGetForm(itemId)
GameCenter.ItemQuickGetSystem:OpenItemQuickGetForm(itemId)
end
function Main.ShowItemTips(goods, obj, location, isShowGetBtn, cost, isResetPosion, ExtData)
GameCenter.ItemTipsMgr:ShowTips(goods, obj, location, isShowGetBtn, cost, isResetPosion, ExtData)
end
function Main.ShowItemTipsByID(id, obj, isShowGetBtn, location)
GameCenter.ItemTipsMgr:ShowTipsByCfgid(id, obj, isShowGetBtn, location)
end
function Main.CloseItemTips()
GameCenter.ItemTipsMgr:Close()
end
function Main.HasJoinedGuild()
return GameCenter.GuildSystem:HasJoinedGuild()
end
function Main.OnExitGuildMsg()
GameCenter.GuildSystem:OnExitGuildMsg()
end
function Main.DownLoadPayList()
GameCenter.PaySystem:DownLoadPayList()
end
function Main.GetLoginAccount()
return GameCenter.LoginSystem.Account;
end
function Main.ReconnectGameServer(isChangeRole)
GameCenter.LoginSystem:ReconnectGameServer(isChangeRole);
end
function Main.GetCurrServerID()
local _cur = GameCenter.ServerListSystem:GetCurrentServer();
if _cur then
return _cur.ServerId;
end
return -1;
end
function Main.GetCurrServerName()
local _cur = GameCenter.ServerListSystem:GetCurrentServer();
if _cur then
return _cur.Name;
end
return "";
end
function Main.HasServer(serverID)
local _item = GameCenter.ServerListSystem:FindServer(serverID)
if _item then
return true;
end
return false;
end
function Main.GetServerName(serverID)
local _item = GameCenter.ServerListSystem:FindServer(serverID)
if _item then
return _item.Name;
end
return "";
end
function Main.GetServerShowID(serverID)
local _item = GameCenter.ServerListSystem:FindServer(serverID)
if _item then
return _item.ShowServerId;
end
return 0;
end
function Main.GetReallyServerID(serverID)
local _item = GameCenter.ServerListSystem:FindServer(serverID)
if _item then
return _item.ReallyServerId;
end
return 0;
end
function Main.OpenLoadingForm(callBack)
GameCenter.LoadingSystem:Open(callBack);
end
function Main.CloseLoadingForm()
GameCenter.LoadingSystem:Close();
end
function Main.SetLoadingFormProgress(val)
GameCenter.LoadingSystem:SetProgress(val/10000);
end
--刷新player的模型数据
function Main.RefreshPlayerModel(player,info)
RoleVEquipTool.RefreshPlayerModel(player,info);
end
function Main.OpenNpcTalk(npc, taskID, isTaskOpenUI, openUIParam)
GameCenter.NpcTalkSystem:OpenNpcTalk(npc, taskID, isTaskOpenUI, openUIParam)
end
function Main.BindLuaCharacter(character, initInfo)
GameCenter.LuaCharacterSystem:BindLuaCharacter(character, initInfo)
end
--创建角色展示信息的对象
function Main.CreatePlayerVisualInfo(roleId)
return GameCenter.PlayerVisualSystem:GetVisualInfo(roleId);
end
--创建FSkinModel
function Main.CreateFSkinModel(code)
return FSkinModelWrap:New(code):GetCSObj();
end
--队伍是否存在
function Main.IsTeamExist()
return GameCenter.TeamSystem:IsTeamExist()
end
--是否是队员
function Main.IsTeamMember(id)
return GameCenter.TeamSystem:IsTeamMember(id)
end
--获取好友界面类型
function Main.GetFriendType()
return UnityUtils.GetObjct2Int(GameCenter.FriendSystem.PageType)
end
function Main.IsEnemy(id)
return GameCenter.FriendSystem:IsEnemy(id)
end
function Main.IsFriend(id)
return GameCenter.FriendSystem:IsFriend(id)
end
function Main.IsShield(id)
return GameCenter.FriendSystem:IsShield(id)
end
function Main.GetHolyPartFightPower(part)
local _equip = GameCenter.HolyEquipSystem:GetDressEquip(part)
if _equip ~= nil and _equip.Equip ~= nil then
return _equip.Equip.Power
end
return 0
end
function Main.GetDressHolyEquip(part)
local _equip = GameCenter.HolyEquipSystem:GetDressEquip(part)
if _equip ~= nil then
return _equip.Equip
end
return nil
end
function Main.CanUseSkill(skillId)
return GameCenter.PlayerSkillSystem:CanUseSkill(skillId)
end
function Main.SkillIsSyncServer(skillId)
return GameCenter.PlayerSkillSystem:SkillIsSyncServer(skillId)
end
function Main.SkillIsCD(skillId)
return GameCenter.PlayerSkillSystem:SkillIsCD(skillId)
end
function Main.GetMandateSkillList()
return GameCenter.PlayerSkillSystem:GetMandateSkillList()
end
function Main.SetFlySwordSkill(swordSkill, playerSkill)
GameCenter.PlayerSkillSystem:SetFlySwordSkill(DataConfig.DataSkill[swordSkill], DataConfig.DataSkill[playerSkill])
end
function Main.StartMandate(monsterId)
if GameCenter.MandateSystem ~= nil then
GameCenter.MandateSystem:Start(monsterId)
end
end
function Main.EndMandate()
if GameCenter.MandateSystem ~= nil then
GameCenter.MandateSystem:End()
end
end
function Main.RestartMandate()
if GameCenter.MandateSystem ~= nil then
GameCenter.MandateSystem:ReStart()
end
end
function Main.MandateOnMove()
if GameCenter.MandateSystem ~= nil then
GameCenter.MandateSystem:OnMove()
end
end
function Main.SetMandatePause(time)
if GameCenter.MandateSystem ~= nil then
GameCenter.MandateSystem:SetPauseTime(time)
end
end
function Main.IsMandating()
if GameCenter.MandateSystem ~= nil then
return GameCenter.MandateSystem:IsRunning()
end
return false
end
function Main.RefreshMandatePos()
if GameCenter.MandateSystem ~= nil then
GameCenter.MandateSystem:RefreshStartPos()
end
end
function Main.StartMove()
GameCenter.PushFixEvent(UILuaEventDefine.UIAutoSearchPathForm_OPEN)
end
function Main.EndMove()
GameCenter.PushFixEvent(UILuaEventDefine.UIAutoSearchPathForm_CLOSE)
end
--动作转换
function Main.GetTranslateAnimName(animObj, animName, modeType, selfBoneIndex, parentBoneIndex, inWrapMode)
if GameCenter.AnimManager ~= nil then
return GameCenter.AnimManager:GetTranslateAnimName(animObj, animName, modeType, selfBoneIndex, parentBoneIndex, inWrapMode)
end
return animName, inWrapMode
end
--任务进入位面
function Main.TaskEnterPlane(taskId)
local _type = GameCenter.LuaTaskManager:GetBehaviorType(taskId)
if _type == TaskBeHaviorType.ArrivePosEx then
local _behavior = GameCenter.LuaTaskManager:GetBehavior(taskId)
if _behavior ~= nil then
GameCenter.Network.Send("MSG_zone.ReqEnterZone", {modelId = _behavior.PlaneCopyId})
end
end
end
--任务进入位面放动画
function Main.TaskEnterPlaneAnim(taskId)
local _type = GameCenter.LuaTaskManager:GetBehaviorType(taskId)
if _type == TaskBeHaviorType.ArriveToAnim then
local _behavior = GameCenter.LuaTaskManager:GetBehavior(taskId)
if _behavior ~= nil then
GameCenter.Network.Send("MSG_zone.ReqEnterZone", {modelId = _behavior.PlaneCopyId})
end
end
end
--游戏消息处理
function Main.OnGameMessage(msg)
if GameCenter.GameMessager ~= nil then
return GameCenter.GameMessager.OnGameMessage(msg)
end
return false
end
--切换Shader的处理
function Main.ShaderSwitch(sh,modeltype,imodelid)
return FGameObjectShaderUtils.ShaderSwitch(sh,modeltype,imodelid)
end
function Main.OnClientGM(cmd)
local _result = false
if cmd == "@@faxingsucai@@" then
GameCenter.PushFixEvent(UILuaEventDefine.UIFaXingSuCaiForm_OPEN)
_result = true
elseif string.find(cmd, "@@mountspeed ") then
local _cmdParams = Utils.SplitStr(cmd, ' ')
local _speed = tonumber(_cmdParams[2])
if _speed ~= nil then
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
if _lp ~= nil then
_lp.MountAnimSpeed = _speed
end
end
end
return _result
end
function Main.SetPlayerHead(trans, iconFashionId, frameFashionId, occ, playerId, headPicId, isShowHeadPic)
local _head = PlayerHead:New(trans)
if _head ~= nil then
_head:SetHead(iconFashionId, frameFashionId, occ, playerId, headPicId, isShowHeadPic)
end
end
function Main.SetPlayerLevel(trans, level, showLevelText)
local _level = PlayerLevel:OnFirstShow(trans)
if _level ~= nil then
_level:SetLevel(level, showLevelText)
end
end
function Main.EnterFengXi(cityId)
if GameCenter.CrossFuDiSystem:OyLiKaiIsOpen() then
GameCenter.CrossFuDiSystem:SetCurCityId(cityId)
GameCenter.CrossFuDiSystem:SetEnterCityId(cityId)
GameCenter.CrossFuDiSystem:SetCurSelectBossId(0)
GameCenter.CrossFuDiSystem:ReqCrossFudEnter(cityId, 1)
GameCenter.CrossFuDiSystem.IsHelpFengXi = true
else
GameCenter.MsgPromptSystem:ShowPrompt(DataConfig.DataMessageString.Get("C_GUMOFENGYING_END"))
end
end
function Main.GetWordFilterIngore()
return "  &*"
end
function Main.CreateItembaseByCfgId(itemId)
local _result = LuaItemBase.CreateItemBase(itemId)
if type(_result) == "table" then
return _result._SuperObj_
else
return _result
end
end
return Main