This commit is contained in:
2020-07-10 13:22:24 +08:00
parent 8c154e38ba
commit 9549990b66
108 changed files with 5668 additions and 888 deletions

View File

@@ -17,10 +17,11 @@ function _cell.init(csObj)
uiobjs.LabelStatus = getCC(transform, "LabelStatus", "UIPopupList")
-- uiobjs.LabelCustName = getCC(transform, "LabelCustName", "UILabel")
-- uiobjs.SpriteStatus = getCC(transform, "SpriteStatus", "UISprite")
-- uiobjs.LabelServerNo = getCC(transform, "LabelServerNo", "UILabel")
uiobjs.LabelServerNo = getCC(transform, "LabelServerNo", "UILabel")
---@type CLUIFormRoot
uiobjs.formRoot = csSelf:GetComponent("CLUIFormRoot")
uiobjs.SpriteStatus = getChild(transform, "SpriteStatus")
uiobjs.SpriteHeadIcon = getCC(transform, "SpriteHeadBg/SpriteHeadIcon", "UITexture")
end
-- 显示,
@@ -36,6 +37,24 @@ function _cell.show(go, data)
else
SetActive(uiobjs.SpriteStatus.gameObject, false)
end
_cell.setHeadIcon()
end
function _cell.setHeadIcon()
---@type _DBUser
local user = DBUser.getUserById(mData.serviceNo)
if user then
uiobjs.LabelServerNo.text = user.loginName
DBUser.getIcon(
mData.serviceNo,
function(texture)
if texture and texture.name == user.imageUrl then
uiobjs.SpriteHeadIcon.mainTexture = texture
end
end
)
end
end
-- 取得数据

View File

@@ -1,20 +1,29 @@
---@class _ParamFieldAttr
---@field attrType
---@field ifMust
---@field ifMust boolean 1:true
---@field attrName
---@field attrValue
---@field id
---@field checkMin
---@field checkMax
---@field popOptions
---@field popValues
---@field donotJoinKey boolean 是否要拼接key
---@class _ParamCellExtendField
---@field
---@class _ParamCellExtendFiled
---@field isEditMode boolean
---@field attr _ParamFieldAttr
---@field onSelect function 当选择了poplist
---@field onClick function 当点击了输入框
---@field onInputChange
---@field onMultTextInputChg
-- xx单元
local _cell = {}
---@type Coolape.CLCellLua
local csSelf = nil
local transform = nil
---@type _ParamCellExtendFiled
local mData = nil
---@type _ParamFieldAttr
local attr
@@ -56,6 +65,7 @@ end
function _cell.show(go, data)
mData = data
attr = mData.attr
attr.ifMust = attr.ifMust or 0
if data.isEditMode then
_cell.enabeldObj(uiobjs.boxCollider, true)
@@ -80,21 +90,26 @@ function _cell.show(go, data)
end
_cell.enabeldObj(uiobjs.Label4, false)
_cell.enabeldObj(uiobjs.SpriteRight, false)
if uiobjs.ButtonReset then
uiobjs.ButtonReset.disabled = true
end
end
local jsonKey = joinStr(attr.id, "_", attr.attrName)
local jsonKey
if attr.donotJoinKey then
jsonKey = attr.id
else
jsonKey = joinStr(attr.id, "_", attr.attrName)
end
if uiobjs.element then
uiobjs.element.valueIsNumber = false
uiobjs.element.isPhoneNum = false
uiobjs.element.canNull = (attr.ifMust == 1 and false or true)
uiobjs.element.canNull = (attr.ifMust == 0 and true or false)
uiobjs.element.jsonKey = jsonKey
uiobjs.element.labeName.text = attr.attrName
elseif uiobjs.checkbox then
uiobjs.checkbox.canNull = (attr.ifMust == 1 and false or true)
uiobjs.checkbox.canNull = (attr.ifMust == 0 and true or false)
uiobjs.checkbox.jsonKey = jsonKey
uiobjs.checkbox.labeName.text = attr.attrName
end
@@ -119,13 +134,17 @@ function _cell.show(go, data)
uiobjs.checkbox:init(attr)
elseif attr.attrType == DBCust.FieldType.popuplist then
_cell.enabeldObj(uiobjs.input, false)
local strs = strSplit(attr.attrValue, "|")
local array = ArrayList()
array:Add("")
for i, v in ipairs(strs) do
array:Add(v)
if attr.popOptions then
uiobjs.popList:refreshItems(attr.popOptions, attr.popValues)
else
local strs = strSplit((attr.attrValue or ""), "|")
local array = ArrayList()
-- array:Add("")
for i, v in ipairs(strs) do
array:Add(v)
end
uiobjs.popList:refreshItems(array, array)
end
uiobjs.popList:refreshItems(array, array)
end
end
@@ -143,9 +162,14 @@ end
function _cell.uiEventDelegate(go)
if attr.attrType == DBCust.FieldType.multext then
-- 说明大文本框改变了
mData.parent.onMultTextInputChg()
NGUITools.AddWidgetCollider(csSelf.gameObject, false)
uiobjs.Label4.enabled = (uiobjs.element.value == "" and true or false)
Utl.doCallback(mData.onMultTextInputChg, csSelf.gameObject)
elseif
attr.attrType == DBCust.FieldType.number or attr.attrType == DBCust.FieldType.phone or
attr.attrType == DBCust.FieldType.text
then
Utl.doCallback(mData.onInputChange, csSelf.gameObject)
end
end

View File

@@ -1,18 +1,19 @@
-- xx单元
---@class _ParamCellExtendFiledRoot
---@field data any
---@field fields table _ParamCellExtendFiled的list
---@field onFinish function 当加载完成
-- xx单元
local _cell = {}
---@type Coolape.CLCellLua
local csSelf = nil
local transform = nil
---@type _ParamCellExtendFiledRoot
local mData = nil
local uiobjs = {}
---@type _DBCust
local cust
local fields
local fieldsObjs = {}
local isEditMode = true
local taskId = nil
local isFieldLoading = false
local oldtaskId
local queue = CLLQueue.new()
local isLoading = false
-- 初始化,只调用一次
function _cell.init(csObj)
@@ -27,10 +28,14 @@ end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
mData = data
cust = data.data or {}
isEditMode = data.isEditMode
_cell.release()
queue:enQueue(data)
if not isLoading then
_cell.refresh()
end
end
function _cell.refresh()
--[[
local taskId = tostring(cust.taskId)
if (not isFieldLoading) or taskId ~= oldtaskId then
isFieldLoading = true
@@ -41,13 +46,23 @@ function _cell.show(go, data)
_cell.initField(1, taskId)
end
end
end
function _cell.initField(index, taskId)
if taskId ~= oldtaskId then
]]
if queue:size() == 0 then
return
end
local fileAttr = fields[index]
_cell.release()
isLoading = true
mData = queue:deQueue()
if mData.fields and #(mData.fields) > 0 then
showHotWheel()
_cell.initField(1)
else
_cell.onFinisInitFields()
end
end
function _cell.initField(index)
local fileAttr = mData.fields[index].attr
local name = ""
if fileAttr.attrType == DBCust.FieldType.popuplist then
name = "InputPoplist"
@@ -60,50 +75,51 @@ function _cell.initField(index, taskId)
else
name = "InputText"
end
CLUIOtherObjPool.borrowObjAsyn(name, _cell.onLoadField, {index = index, taskId = taskId})
CLUIOtherObjPool.borrowObjAsyn(name, _cell.onLoadField, index)
end
---@param go UnityEngine.GameObject
function _cell.onLoadField(name, go, orgs)
local index = orgs.index
local taskId = orgs.taskId
if taskId ~= oldtaskId then
hideHotWheel()
CLUIOtherObjPool.returnObj(go)
SetActive(go, false)
return
end
local index = orgs
go.transform.parent = transform
go.transform.localScale = Vector3.one
go.transform.localEulerAngles = Vector3.zero
local fileAttr = fields[index]
---@type _ParamCellExtendFiled
local param = mData.fields[index]
local cell = go:GetComponent("CLCellLua")
SetActive(go, true)
cell:init(
{
attr = fileAttr,
parent = _cell,
isEditMode = isEditMode,
onClick = mData.onClick,
onSelect = mData.onSelect
},
nil
)
--[[
---@type _ParamCellExtendFiled
local param = {
attr = fileAttr,
onMultTextInputChg = _cell.onMultTextInputChg,
isEditMode = isEditMode,
onClick = mData.onClick,
onSelect = mData.onSelect
}
]]
if param.attr.attrType == DBCust.FieldType.multext then
-- 要设置一次
param.orgOnMultTextInputChg = param.onMultTextInputChg
param.onMultTextInputChg = _cell.onMultTextInputChg
end
cell:init(param, nil)
table.insert(fieldsObjs, cell)
uiobjs.Table:Reposition()
if index == #fields then
if index == #(mData.fields) then
_cell.onFinisInitFields()
else
_cell.initField(index + 1, taskId)
_cell.initField(index + 1)
end
end
function _cell.onFinisInitFields()
isFieldLoading = false
isLoading = false
uiobjs.Table:Reposition()
uiobjs.formRoot:setValue(cust.jsonStr)
uiobjs.formRoot:setValue(mData.data)
Utl.doCallback(mData.onFinish)
hideHotWheel()
_cell.refresh()
end
function _cell.release()
@@ -114,8 +130,16 @@ function _cell.release()
fieldsObjs = {}
end
function _cell.onMultTextInputChg()
function _cell.onMultTextInputChg(go)
uiobjs.Table.repositionNow = true
---@param v _ParamCellExtendFiled
if mData then
for i, v in ipairs(mData.fields) do
if v.attr.attrType == DBCust.FieldType.multext then
Utl.doCallback(v.orgOnMultTextInputChg, go)
end
end
end
end
-- 取得数据

View File

@@ -0,0 +1,43 @@
-- xx单元
local _cell = {}
---@type Coolape.CLCellLua
local csSelf = nil
local transform = nil
local mData = nil
local uiobjs = {}
-- 初始化,只调用一次
function _cell.init(csObj)
csSelf = csObj
transform = csSelf.transform
uiobjs.SpriteIcon = getCC(transform, "SpriteIcon", "UISprite")
uiobjs.Label = getCC(transform, "Label", "UILabel")
uiobjs.Label2 = getCC(transform, "Label2", "UILabel")
end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.refresh(data, index)
mData = data
if mData then
SetActive(uiobjs.SpriteIcon.gameObject, true)
CLUIUtl.setSpriteFit(uiobjs.SpriteIcon, joinStr("guid_", mData.index))
uiobjs.Label.text = mData.label
uiobjs.Label2.text = mData.label2
else
SetActive(uiobjs.SpriteIcon.gameObject, false)
uiobjs.Label.text = ""
uiobjs.Label2.text = ""
end
end
function _cell.refreshCurrent(index, data)
end
-- 取得数据
function _cell.getData()
return mData
end
--------------------------------------------
return _cell

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4c0d53b2d702140a5aff3c3f027c4107
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -22,7 +22,11 @@ end
function _cell.show(go, data)
mData = data
uiobjs.formRoot:setValue(mData)
uiobjs.ButtonPlayVoice.isEnabled = (not isNilOrEmpty(mData.recordfile))
if not isNilOrEmpty(mData.recordfile) then
SetActive(uiobjs.ButtonPlayVoice.gameObject, true)
else
SetActive(uiobjs.ButtonPlayVoice.gameObject, false)
end
uiobjs.LabelLen.text = joinStr("录音:", DateEx.toStrCn(tonumber(mData.answertime)*1000))
end