UIChat部分支持红点

This commit is contained in:
fatiao 2026-02-12 16:57:23 +08:00
parent 2ad5debf79
commit b80a700380
5 changed files with 29 additions and 35 deletions

View File

@ -20202,7 +20202,7 @@ MonoBehaviour:
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 1
m_Spacing: 2
m_Spacing: 20
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
@ -23778,7 +23778,6 @@ GameObject:
m_Component:
- component: {fileID: 6597347289572171726}
- component: {fileID: 4973907414672328632}
- component: {fileID: 9078399487502680034}
- component: {fileID: 8550598987683907859}
m_Layer: 5
m_Name: RedPoint
@ -23786,7 +23785,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &6597347289572171726
RectTransform:
m_ObjectHideFlags: 0
@ -23803,7 +23802,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -10, y: -10}
m_AnchoredPosition: {x: -33.7, y: -26.2}
m_SizeDelta: {x: 56, y: 56}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4973907414672328632
@ -23814,36 +23813,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8853271749901229638}
m_CullTransparentMesh: 0
--- !u!114 &9078399487502680034
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8853271749901229638}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 01fc6dfb7806e454595b5a754d4cff73, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &8550598987683907859
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -3397,8 +3397,8 @@ RectTransform:
m_Children:
- {fileID: 5695566469530501736}
- {fileID: 8686483031141590590}
- {fileID: 2754360920761901112}
- {fileID: 2765585946249365751}
- {fileID: 2754360920761901112}
- {fileID: 602150543970277784}
- {fileID: 4277932189784085218}
- {fileID: 8123859824791095904}

View File

@ -2,6 +2,7 @@
---@field public gameObject UnityEngine.GameObject
---@field public button UnityEngine.UI.Button
---@field public lock UnityEngine.GameObject
---@field public redPoint UnityEngine.GameObject
---@class ChatSearchTabItem__Generate_commentNum
---@field public gameObject UnityEngine.GameObject
@ -131,6 +132,7 @@ function ChatSearchTabItemView:InitGenerate(Root, data)
self:InitGenerate__22(Root,data)
self:InitGenerate__23(Root,data)
self:InitGenerate__24(Root,data)
self:InitGenerate__25(Root,data)
end
@ -450,8 +452,23 @@ function ChatSearchTabItemView:InitGenerate__24(Root, data)
self.greetBtn.lock = tmp
end
---@private
function ChatSearchTabItemView:InitGenerate__25(Root, data)
--[[
Right/BottomPart/GreetBtn/RedPoint
--]]
local tmp = Root:Find("Right/BottomPart/GreetBtn/RedPoint").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.greetBtn.redPoint = tmp
end
---@private
function ChatSearchTabItemView:GenerateDestroy()
if tolua.getpeer(self.greetBtn.redPoint) ~= nil then
tolua.setpeer(self.greetBtn.redPoint, nil)
end
if tolua.getpeer(self.greetBtn.lock) ~= nil then
tolua.setpeer(self.greetBtn.lock, nil)
end

View File

@ -989,6 +989,7 @@ function UIChatView:SetSearchTabItem(itemLua, idx, itemData)
itemLua.greetBtn.lock:SetActive(isUnlock==false)
itemLua.greetBtn.button.interactable = isUnlock
if isUnlock then
CommonUtil.CreateNormalRedPoint(itemLua.greetBtn.redPoint, function(rp)end)
self.uiBase:AddButtonUniqueEventListener(itemLua.greetBtn.button, self, function() self:OnGreetBtn(itemData) end)
end
end

View File

@ -3157,3 +3157,10 @@ function CreateNewRedPoint(parent, cb)
end
end)
end
function RemoveRedPoint(parent)
for i = _target.transform.childCount-1, 0, -1 do
local _child = _target.transform:GetChild(i)
DestroyGO(_child.gameObject)
end
end