【御剑行】竞猜,差一个三级弹窗
parent
6870073129
commit
018c09d69c
|
@ -2296,6 +2296,7 @@ GameObject:
|
|||
- component: {fileID: 6631848793314026999}
|
||||
- component: {fileID: 3358268583033886714}
|
||||
- component: {fileID: 6120685569817044524}
|
||||
- component: {fileID: 7869113865088616047}
|
||||
m_Layer: 5
|
||||
m_Name: btnBet
|
||||
m_TagString: Untagged
|
||||
|
@ -2402,6 +2403,25 @@ MonoBehaviour:
|
|||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
--- !u!95 &7869113865088616047
|
||||
Animator:
|
||||
serializedVersion: 3
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 60993485954371769}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: 6ffe000b5a58aac48a9d130543849d76, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorControllerStateOnDisable: 0
|
||||
--- !u!1 &64493619873292982
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -3492,7 +3512,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 10.4}
|
||||
m_AnchoredPosition: {x: 0, y: 10.400024}
|
||||
m_SizeDelta: {x: 0, y: -110.7}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &897061360882536434
|
||||
|
@ -6379,7 +6399,7 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 223092219132825529}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
|
@ -10817,8 +10837,8 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -16, y: 2}
|
||||
m_SizeDelta: {x: 185, y: 40}
|
||||
m_AnchoredPosition: {x: -38.3, y: 2}
|
||||
m_SizeDelta: {x: 140.3, y: 40}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &446389137000568109
|
||||
CanvasRenderer:
|
||||
|
@ -13867,80 +13887,6 @@ Animator:
|
|||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorControllerStateOnDisable: 0
|
||||
--- !u!1 &5387731587144175453
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1684561754597089565}
|
||||
- component: {fileID: 8852393445114718030}
|
||||
- component: {fileID: 2693545212386052001}
|
||||
m_Layer: 0
|
||||
m_Name: addBtn
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1684561754597089565
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5387731587144175453}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 223092219132825529}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 60, y: 2}
|
||||
m_SizeDelta: {x: 67, y: 68}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8852393445114718030
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5387731587144175453}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &2693545212386052001
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5387731587144175453}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 21300000, guid: 49a156ba0c3868f469544ef70157cab0, 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
|
||||
--- !u!1 &5407579828044611261
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -17668,7 +17614,6 @@ RectTransform:
|
|||
m_Children:
|
||||
- {fileID: 2205205437791079831}
|
||||
- {fileID: 8615651565160363594}
|
||||
- {fileID: 1684561754597089565}
|
||||
- {fileID: 8723465581958594382}
|
||||
m_Father: {fileID: 7830425952965198751}
|
||||
m_RootOrder: 2
|
||||
|
|
|
@ -1,26 +1,114 @@
|
|||
----- 御剑行竞猜 -----
|
||||
local this = {}
|
||||
local swordImg = {
|
||||
[1] = "y_yujianxing_banner04",
|
||||
[2] = "y_yujianxing_banner01",
|
||||
[3] = "y_yujianxing_banner02",
|
||||
[4] = "y_yujianxing_banner03",
|
||||
}
|
||||
local configData = ConfigManager.GetConfigData(ConfigName.RidingSwardConfig,1)
|
||||
|
||||
function this:InitComponent(gameObject)
|
||||
self.spLoader = SpriteLoader.New()
|
||||
self.grid = Util.GetGameObject(gameObject,"Grid")
|
||||
self.SwordPre = Util.GetGameObject(self.grid,"SwordPre")
|
||||
self.SwordPre:SetActive(false)
|
||||
self.roundTime = Util.GetGameObject(gameObject,"tips (2)"):GetComponent("Text")
|
||||
|
||||
self.itemNum = Util.GetGameObject(gameObject,"itemBar/Text"):GetComponent("Text")
|
||||
self.itemImage = Util.GetGameObject(gameObject,"itemBar/Image"):GetComponent("Image")
|
||||
self.preList = {}
|
||||
end
|
||||
|
||||
function this:BindEvent()
|
||||
end
|
||||
|
||||
function this:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
||||
end
|
||||
|
||||
function this:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
||||
end
|
||||
|
||||
function this:OnShow()
|
||||
function this:OnShow(_parent)
|
||||
self.parent = _parent
|
||||
self:Refresh()
|
||||
end
|
||||
|
||||
function this:Refresh()
|
||||
NetManager.RidingSwardInfoRequest(function ()
|
||||
local serverData = YuJianXingManager.curBetList
|
||||
for i = 1, 4 do
|
||||
local go = self.preList[i]
|
||||
if not go then
|
||||
go = newObjToParent(self.SwordPre,self.grid)
|
||||
go:SetActive(true)
|
||||
self.preList[i] = go
|
||||
end
|
||||
local Img = go:GetComponent("Image")
|
||||
local selectImg = Util.GetGameObject(go,"State")
|
||||
local betImg = Util.GetGameObject(go,"Info"):GetComponent("Image")
|
||||
local costImg = Util.GetGameObject(go,"Cost/Image"):GetComponent("Image")
|
||||
local num = Util.GetGameObject(go,"Cost/num"):GetComponent("Text")
|
||||
local betNum = Util.GetGameObject(go,"Info/Text"):GetComponent("Text")
|
||||
local btnBet = Util.GetGameObject(go,"btnBet")
|
||||
|
||||
Img.sprite = self.spLoader:LoadSprite(swordImg[i])
|
||||
selectImg:SetActive(false)
|
||||
betImg.sprite = self.spLoader:LoadSprite("y_yujianxing_weijingcai")
|
||||
costImg.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(configData.JoinCost[1]))
|
||||
num.text = configData.JoinCost[2]
|
||||
betNum.text = string.format("<color=#9599A7>赔率1:%s</color>",(configData.RateList[i])/10000)
|
||||
Util.SetGray(btnBet,false)
|
||||
btnBet:GetComponent("Button").interactable = true
|
||||
for j = 1, #serverData do
|
||||
if serverData[j].swardId == i then
|
||||
betNum.text = string.format("<color=#CF9258>赔率1:%s</color>",(configData.RateList[i])/10000)
|
||||
selectImg:SetActive(true)
|
||||
betImg.sprite = self.spLoader:LoadSprite("y_yujianxing_yijingcai")
|
||||
Util.SetGray(btnBet,true)
|
||||
btnBet:GetComponent("Button").interactable = false
|
||||
end
|
||||
end
|
||||
Util.AddOnceClick(btnBet,function ()
|
||||
NetManager.RidingSwardBetRequest(i,100,function ()
|
||||
self:Refresh()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
self:SetTime()
|
||||
self.itemNum.text = BagManager.GetTotalItemNum(configData.JoinCost[1])
|
||||
self.itemImage.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(configData.JoinCost[1]))
|
||||
end)
|
||||
end
|
||||
|
||||
function this:SetTime()
|
||||
local roundTime = YuJianXingManager.nextTimeCount- GetTimeStamp()
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
self.roundTime.text = string.format("距本轮竞猜结束: %s",TimeToMS(roundTime))
|
||||
self.timer = Timer.New(function ()
|
||||
roundTime = roundTime - 1
|
||||
self.roundTime.text = string.format("距本轮竞猜结束: %s",TimeToMS(roundTime))
|
||||
if roundTime <= 0 then
|
||||
self.parent:ClosePanel()
|
||||
end
|
||||
end,1,-1)
|
||||
self.timer:Start()
|
||||
end
|
||||
|
||||
function this:OnClose()
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
end
|
||||
|
||||
function this:OnDestroy()
|
||||
self.preList = {}
|
||||
self.spLoader:Destroy()
|
||||
end
|
||||
|
||||
|
|
|
@ -25,14 +25,19 @@ function this:BindEvent()
|
|||
end
|
||||
|
||||
function this:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.YuJianXing.UpdateRank, self.OnShow,self)
|
||||
Game.GlobalEvent:AddEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
||||
end
|
||||
|
||||
function this:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.YuJianXing.UpdateRank, self.OnShow,self)
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
||||
end
|
||||
|
||||
function this:OnShow()
|
||||
function this:OnShow(_parent,...)
|
||||
self.parent = _parent
|
||||
self:Refresh()
|
||||
end
|
||||
|
||||
function this:Refresh()
|
||||
NetManager.RidingSwardInfoRequest(function ()
|
||||
local data = ConfigManager.GetConfigData(ConfigName.RidingSwardResult,YuJianXingManager.lastResult.rankId).Result
|
||||
for i = 1, 4 do
|
||||
|
@ -40,13 +45,13 @@ function this:OnShow()
|
|||
local go = self.preList[i]
|
||||
if not go then
|
||||
go = newObjToParent(self.SwordPre,self.grid)
|
||||
go:SetActive(true)
|
||||
self.preList[i] = go
|
||||
end
|
||||
local rank = Util.GetGameObject(go,"Image"):GetComponent("Image")
|
||||
local Img = go:GetComponent("Image")
|
||||
rank.sprite = self.spLoader:LoadSprite(rankImg[i])
|
||||
Img.sprite = self.spLoader:LoadSprite(SwordImg[tempData])
|
||||
go:SetActive(true)
|
||||
end
|
||||
self.roundTime.text = string.format("比赛场次: %s",TimeStampToDateStr4((YuJianXingManager.lastResult.rankTime)/1000))
|
||||
end)
|
||||
|
@ -56,6 +61,7 @@ function this:OnClose()
|
|||
end
|
||||
|
||||
function this:OnDestroy()
|
||||
self.preList = {}
|
||||
self.spLoader:Destroy()
|
||||
end
|
||||
|
||||
|
|
|
@ -5954,7 +5954,7 @@ end
|
|||
--御剑行请求竞猜
|
||||
function this.RidingSwardBetRequest(_swardId,_costNum,func)
|
||||
local data = ActivityProto_pb.RidingSwardBetRequest()
|
||||
data.time = _swardId
|
||||
data.swardId = _swardId
|
||||
data.costNum = _costNum
|
||||
local msg = data:SerializeToString()
|
||||
Network:SendMessageWithCallBack(MessageTypeProto_pb.RidingSwardBetRequest , MessageTypeProto_pb.RidingSwardInfoResponse , msg, function(buffer)
|
||||
|
|
|
@ -67,7 +67,9 @@ function this.UpdataServerData(msg,func)
|
|||
LogError("御剑行剧本id为0:")
|
||||
return
|
||||
end
|
||||
this.curRecordList = {}
|
||||
this.curRecordList = msg.recordLsit
|
||||
this.curBetList = {}
|
||||
this.curBetList = msg.betList
|
||||
if func then
|
||||
func()
|
||||
|
|
Loading…
Reference in New Issue