SK_LongZhu
zhangjiannan 2024-10-24 15:32:47 +08:00
parent db97daa792
commit c3f6ca697b
7 changed files with 2193 additions and 2072 deletions

View File

@ -13,7 +13,7 @@ Material:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3001
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:

View File

@ -76,8 +76,8 @@ Material:
- _SrcBlend: 1
- _Trans: 10
- _UVSec: 0
- _X: 0.5
- _Y: 0.5
- _X: 0.49537036
- _Y: 0.14452082
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}

View File

@ -5072,7 +5072,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -240, y: 40}
m_SizeDelta: {x: 223, y: 234}
m_SizeDelta: {x: 420, y: 448.8}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &175409437497199103
CanvasRenderer:
@ -69830,7 +69830,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 240, y: 40}
m_SizeDelta: {x: 223, y: 227}
m_SizeDelta: {x: 420, y: 448.8}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &442090213806620482
CanvasRenderer:

View File

@ -2877,7 +2877,7 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 7b5d246b7cac8f841ad311cd02b33c78, type: 3}
m_Sprite: {fileID: 21300000, guid: 9693cd56831af6c4899c7c900a05f231, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1

File diff suppressed because it is too large Load Diff

View File

@ -9,17 +9,21 @@ local girlBigLive = "live2d_npc_girl"
local boyLiveRes = "live2d_npc_map_boy"
local girlLiveRes = "live2d_npc_map_nv"
local smallInfo = {[1] = {Pos = Vector3.New(-1, -81, 0), Scale = Vector3.New(0.25, 0.25, 0.25)},
[2] = {Pos = Vector3.New(-1, -81, 0), Scale = Vector3.New(0.25, 0.25, 0.25)},}
local smallInfo = {
[1] = { Pos = Vector3.New(-1, -81, 0), Scale = Vector3.New(0.25, 0.25, 0.25) },
[2] = { Pos = Vector3.New(-1, -81, 0), Scale = Vector3.New(0.25, 0.25, 0.25) },
}
local bigInfo = {
[1] = { Pos = Vector3.New(0, -359, 0), Scale = Vector3.New(0.5, 0.5, 0.5) },
[2] = { Pos = Vector3.New(-33, -382, 0), Scale = Vector3.New(0.45, 0.45, 0.45) },
}
local bigInfo = {[1] = {Pos = Vector3.New(0, -359, 0), Scale = Vector3.New(0.5, 0.5, 0.5)},
[2] = {Pos = Vector3.New(-33, -382, 0), Scale = Vector3.New(0.45, 0.45, 0.45)},}
local curLive
local lastChoose
local orginLayer = 0
local curSex = ROLE_SEX.BOY
local gameSetting=ConfigManager.GetConfigData(ConfigName.GameSetting,1)
local gameSetting = ConfigManager.GetConfigData(ConfigName.GameSetting, 1)
--初始化组件(用于子类重写)
@ -29,7 +33,7 @@ function CreateNamePopup:InitComponent()
this.btnConfirm = Util.GetGameObject(self.gameObject, "Frame/btnConfirm")
this.title = Util.GetGameObject(self.gameObject, "Frame/Title"):GetComponent("Text")
this.textName = Util.GetGameObject(self.gameObject,"Frame/InputField"):GetComponent("InputField")
this.textName = Util.GetGameObject(self.gameObject, "Frame/InputField"):GetComponent("InputField")
this.btnRandName = Util.GetGameObject(self.gameObject, "Frame/randIcon")
this.card = Util.GetGameObject(self.gameObject, "Frame/game/card")
@ -63,7 +67,7 @@ function CreateNamePopup:InitComponent()
this.boyMask = Util.GetGameObject(this.boyEffect, "kuang_man")
this.bitchMask = Util.GetGameObject(this.bitchEffect, "kuang_woman")
this.rewardGrid=Util.GetGameObject(self.gameObject, "createName/rewardGrid")
this.rewardGrid = Util.GetGameObject(self.gameObject, "createName/rewardGrid")
effectAdapte(this.boyMask)
effectAdapte(this.bitchMask)
@ -71,24 +75,20 @@ function CreateNamePopup:InitComponent()
if not this.boyLive then
this.boyLive = poolManager:LoadLive(boyBigLive, this.roleStand.transform,
bigInfo[1].Scale, bigInfo[1].Pos)
bigInfo[1].Scale, bigInfo[1].Pos)
end
if not this.girlLive then
this.girlLive = poolManager:LoadLive(girlBigLive, this.roleStand.transform,
bigInfo[2].Scale, bigInfo[2].Pos)
bigInfo[2].Scale, bigInfo[2].Pos)
end
end
function CreateNamePopup:OnSortingOrderChange()
Util.AddParticleSortLayer(this.boyEffect, self.sortingOrder - orginLayer)
Util.AddParticleSortLayer(this.bitchEffect, self.sortingOrder - orginLayer)
orginLayer = self.sortingOrder
end
-- 计算字符串宽度 可以计算出字符宽度,用于显示使用
local function _NameWidth(str)
local lenInByte = #str
@ -100,27 +100,26 @@ local function _NameWidth(str)
local byteCount = 1
local len = 1
if curByte > 0 and curByte <= 127 then
byteCount = 1 --1字节字符
byteCount = 1 --1字节字符
len = 1
elseif curByte >= 192 and curByte < 223 then
byteCount = 2 --双字节字符
byteCount = 2 --双字节字符
len = 1
elseif curByte >= 224 and curByte < 239 then
byteCount = 3 --汉字
byteCount = 3 --汉字
len = 2
elseif curByte >= 240 and curByte <= 247 then
byteCount = 4 --4字节字符
byteCount = 4 --4字节字符
len = 2
end
i = i + byteCount -- 重置下一字节的索引
width = width + len -- 字符的个数(长度)
i = i + byteCount -- 重置下一字节的索引
width = width + len -- 字符的个数(长度)
end
return width
end
--绑定事件(用于子类重写)
function CreateNamePopup:BindEvent()
Util.AddClick(this.btnConfirm, function()
-- 修改昵称时要判断改名卡数量
if not this.showType then
@ -139,7 +138,7 @@ function CreateNamePopup:BindEvent()
local len = _NameWidth(this.textName.text)
if len < 2 or len > 12 then
MsgPanel.ShowOne(Language[11474])
return
return
end
--todo: 添加对非法字符的检测
@ -154,13 +153,11 @@ function CreateNamePopup:BindEvent()
PopupTipPanel.ShowTip(Language[10837])
this:ClosePanel()
end
end
-- 类型3 为修改名称 类型1 为创建角色
local type = this.showType == nil and 3 or 1
NameManager.ChangeUserName(type, this.curName, nil, curSex, callBack)
end)
@ -188,14 +185,13 @@ function CreateNamePopup:BindEvent()
--UIManager.OpenPanel(UIName.GMEspecially)
-- 发送创建角色事件
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.CreateCharacter)
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.RoleLv,1)
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.RoleLv, 1)
end
end
-- 类型3 为修改名称 类型1 为创建角色
local type = this.showType == nil and 3 or 1
NameManager.ChangeUserName(type, this.curName, nil, curSex,callBack)
NameManager.ChangeUserName(type, this.curName, nil, curSex, callBack)
end)
-- 随机名称
@ -222,11 +218,11 @@ function CreateNamePopup:BindEvent()
this:ClosePanel()
end)
Util.AddClick(this.btnBoy, function ()
Util.AddClick(this.btnBoy, function()
this.FreshSex(boy)
end)
Util.AddClick(this.btnBitch, function ()
Util.AddClick(this.btnBitch, function()
this.FreshSex(girl)
end)
@ -248,8 +244,9 @@ function this.FreshSex(sex)
local shadowRes = sex == boy and "c_cjjs_heitou" or "c_cjjs_baitou"
local textRes = sex == boy and "c_cjjs_heizi" or "c_cjjs_baizi"
local boyIconRes = sex == boy and "c_cjjs_heitou_01" or "c_cjjs_heitou_02"
local bitchIconRes = sex == boy and "c_cjjs_baitou_02" or "c_cjjs_baitou_01"
local boyIconRes = sex == boy and "Dragon Ball- (21)" or "Dragon Ball- (21)"
local bitchIconRes = sex == boy and "Dragon Ball- (586)1" or "Dragon Ball- (586)1"
this.boyEffect:SetActive(false)
this.bitchEffect:SetActive(false)
@ -261,9 +258,16 @@ function this.FreshSex(sex)
this.Text.sprite = this.spLoader:LoadSprite(textRes)
this.btnBoy:GetComponent("Image").sprite = this.spLoader:LoadSprite(boyIconRes)
this.btnBitch:GetComponent("Image").sprite = this.spLoader:LoadSprite(bitchIconRes)
if sex == boy then
Util.SetGray(this.btnBoy, false)
Util.SetGray(this.btnBitch, true)
else
Util.SetGray(this.btnBoy, true)
Util.SetGray(this.btnBitch, false)
end
this.btnBoy:GetComponent("Image"):SetNativeSize()
this.btnBitch:GetComponent("Image"):SetNativeSize()
--this.btnBoy:GetComponent("Image"):SetNativeSize()
--this.btnBitch:GetComponent("Image"):SetNativeSize()
this.boyLive:SetActive(sex == boy)
this.girlLive:SetActive(sex ~= boy)
@ -272,18 +276,17 @@ end
function this.LoadLiveBySex(standRes, index)
if not curLive then
curLive = poolManager:LoadLive(standRes, this.roleLive.transform,
smallInfo[index].Scale, smallInfo[index].Pos)
smallInfo[index].Scale, smallInfo[index].Pos)
else
poolManager:UnLoadLive(lastChoose, curLive)
curLive = poolManager:LoadLive(standRes, this.roleLive.transform,
smallInfo[index].Scale, smallInfo[index].Pos)
smallInfo[index].Scale, smallInfo[index].Pos)
end
lastChoose = standRes
end
--添加事件监听(用于子类重写)
function CreateNamePopup:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Event.PointTrigger, this.OnInfoChange)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnNameChange, this.OnRefreshName)
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.RefreshShow)
@ -291,7 +294,6 @@ end
--移除事件监听(用于子类重写)
function CreateNamePopup:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Event.PointTrigger, this.OnInfoChange)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnNameChange, this.OnRefreshName)
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshShow)
@ -300,7 +302,7 @@ end
--界面打开时调用(用于子类重写)
function CreateNamePopup:OnOpen(...)
SoundManager.PlayMusic(SoundConfig.BGM_Main)
local args = {...}
local args = { ... }
this.showType = args[1]
this.eventId = args[2]
this.showValues = args[3]
@ -308,10 +310,10 @@ function CreateNamePopup:OnOpen(...)
this.callBackFunc = args[5]
this.InitName()
this.RefreshShow()
for i=1,#gameSetting.BTBornItemShow do
local view = SubUIManager.Open(SubUIConfig.ItemView,this.rewardGrid.transform)
view:OnOpen(false,gameSetting.BTBornItemShow[i],0.75,true)
view:ResetNameColor(Vector4.New(0.298,0.133,0.10,1))
for i = 1, #gameSetting.BTBornItemShow do
local view = SubUIManager.Open(SubUIConfig.ItemView, this.rewardGrid.transform)
view:OnOpen(false, gameSetting.BTBornItemShow[i], 0.75, true)
view:ResetNameColor(Vector4.New(0.298, 0.133, 0.10, 1))
view:ResetBtnInteractable(false)
end
this.rewardGrid:SetActive(false)
@ -335,12 +337,11 @@ function CreateNamePopup:OnDestroy()
end
if this.boyLive then
poolManager:UnLoadLive(boyBigLive, this.boyLive)
poolManager:UnLoadLive(boyBigLive, this.boyLive)
end
if this.girlLive then
poolManager:UnLoadLive(girlBigLive, this.girlLive)
poolManager:UnLoadLive(girlBigLive, this.girlLive)
end
end
-- 初始化名字显示
@ -358,8 +359,7 @@ function this.RefreshShow()
this.mask:SetActive(false)
this.FreshSex(boy)
else -- 修改名称
else -- 修改名称
this.createnameRoot:SetActive(false)
this.nameChangeRoot:SetActive(true)
this.mask:SetActive(true)
@ -377,4 +377,4 @@ function this.OnInfoChange(_showType, _eventId, _showValues, _options)
end
end
return CreateNamePopup
return CreateNamePopup

View File

@ -6,8 +6,7 @@ local TabBox = require("Modules/Common/TabBox")
local _Tab2Sprite = {
default = "x1_haoyou_biaoqian_weixuanzhong_quekou",
select = "x1_haoyou_biaoqian_xuanzhong",
lock =
"x1_haoyou_biaoqian_weixuanzhong_quekou1"
lock = "x1_haoyou_biaoqian_weixuanzhong_quekou1"
}
local _Tab2FontColor = {
default = Color.New(255 / 255, 255 / 255, 255 / 255, 1),