parent
272cfdc71a
commit
1df7a8006a
File diff suppressed because it is too large
Load Diff
|
@ -235,6 +235,13 @@ function this.GetActivityTypeInfo(type)
|
||||||
end)
|
end)
|
||||||
return missionData
|
return missionData
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function this.GetActivityValueInfo(type, Id)
|
||||||
|
if this.mission[type] then
|
||||||
|
LogBlue("this.mission[type].value:"..this.mission[type].value)
|
||||||
|
return this.mission[type].value
|
||||||
|
end
|
||||||
|
end
|
||||||
function this.GetActivityInfo(type, Id)
|
function this.GetActivityInfo(type, Id)
|
||||||
if this.mission[type] then
|
if this.mission[type] then
|
||||||
for _, missInfo in pairs(this.mission[type].mission) do
|
for _, missInfo in pairs(this.mission[type].mission) do
|
||||||
|
@ -244,7 +251,7 @@ function this.GetActivityInfo(type, Id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Log(string.format(Language[10001], type, Id))
|
Log(string.format(Language[10001], type, Id))
|
||||||
return nil
|
return nil,0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function this.SetActivityInfo(type, Id, state)
|
function this.SetActivityInfo(type, Id, state)
|
||||||
|
@ -1022,9 +1029,11 @@ end
|
||||||
|
|
||||||
function this.GetTimeStartToEnd(type)
|
function this.GetTimeStartToEnd(type)
|
||||||
local info= ActivityGiftManager.GetActivityTypeInfo(type)
|
local info= ActivityGiftManager.GetActivityTypeInfo(type)
|
||||||
local startTime= this.GetTimeShow(info.StartTime)
|
LogBlue(info.endTime)
|
||||||
local endtime= this.GetTimeShow(info.Endtime)
|
LogBlue(info.startTime)
|
||||||
return startTime.."-"..endtime
|
local startTime= this.GetTimeShow(info.startTime)
|
||||||
|
local endtime= this.GetTimeShow(info.endTime)
|
||||||
|
return startTime.."~"..endtime
|
||||||
end
|
end
|
||||||
|
|
||||||
---时间格式化接口
|
---时间格式化接口
|
||||||
|
|
|
@ -15,7 +15,7 @@ function RewardPreview:InitComponent(gameObject)
|
||||||
self.itemGrid=Util.GetGameObject(self.gameObject,"itemGrid")
|
self.itemGrid=Util.GetGameObject(self.gameObject,"itemGrid")
|
||||||
self.itemPre=Util.GetGameObject(self.gameObject,"itemprefab")
|
self.itemPre=Util.GetGameObject(self.gameObject,"itemprefab")
|
||||||
self.curtimes=Util.GetGameObject(self.gameObject,"tip1"):GetComponent("Text")
|
self.curtimes=Util.GetGameObject(self.gameObject,"tip1"):GetComponent("Text")
|
||||||
self.slider=Util.GetGameObject(self.gameObject,"Slider"):GetComponent("Slider")
|
self.slider=Util.GetGameObject(self.gameObject,"Background/Fill"):GetComponent("Image")
|
||||||
end
|
end
|
||||||
|
|
||||||
function RewardPreview:BindEvent()
|
function RewardPreview:BindEvent()
|
||||||
|
@ -26,6 +26,7 @@ function RewardPreview:OnShow()
|
||||||
self.gameObject:SetActive(true)
|
self.gameObject:SetActive(true)
|
||||||
local maxtimesId=lotterySetting[RecruitType.TimeLimitSingle].MaxTimes;
|
local maxtimesId=lotterySetting[RecruitType.TimeLimitSingle].MaxTimes;
|
||||||
curtimes=PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)
|
curtimes=PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)
|
||||||
|
self.slider.fillAmount =self: CalculateInterval(curtimes)
|
||||||
self: RefreshRewarid()
|
self: RefreshRewarid()
|
||||||
self.curtimes.text=Language[12181]..curtimes
|
self.curtimes.text=Language[12181]..curtimes
|
||||||
end
|
end
|
||||||
|
@ -34,14 +35,16 @@ function RewardPreview:RefreshRewarid()
|
||||||
local curActivityId=ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
|
local curActivityId=ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
|
||||||
data = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",curActivityId)
|
data = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",curActivityId)
|
||||||
local tmp=0
|
local tmp=0
|
||||||
|
--间隔的总次数 比如:30 60 120 210 300 count=(60-30)+ (120 - 60)+ (210 - 120)+ (300 - 210)= 300 - 30 =270
|
||||||
local count=0
|
local count=0
|
||||||
for n,m in ipairs(data) do
|
-- for n,m in ipairs(data) do
|
||||||
if n~=1 then
|
-- if n~=1 then
|
||||||
count = count + m.Values[1][1]-tmp
|
-- count = count + m.Values[1][1]-tmp
|
||||||
end
|
-- end
|
||||||
tmp = m.Values[1][1]
|
-- tmp = m.Values[1][1]
|
||||||
self.slider.value = curtimes / m.Values[1][1]
|
-- --self.slider.fillAmount = curtimes / m.Values[1][1]
|
||||||
end
|
-- end
|
||||||
|
count = data[#data].Values[1][1]
|
||||||
tmp=0
|
tmp=0
|
||||||
local position = 0
|
local position = 0
|
||||||
local width = self.itemPre.transform:GetComponent("RectTransform").sizeDelta.x
|
local width = self.itemPre.transform:GetComponent("RectTransform").sizeDelta.x
|
||||||
|
@ -59,19 +62,54 @@ function RewardPreview:RefreshRewarid()
|
||||||
o:OnOpen(false, {m.Reward[1][1], m.Reward[1][2]}, 1.1, true)
|
o:OnOpen(false, {m.Reward[1][1], m.Reward[1][2]}, 1.1, true)
|
||||||
o.gameObject:SetActive(true)
|
o.gameObject:SetActive(true)
|
||||||
Util.GetGameObject(listPre[n].gameObject,"progress"):GetComponent("Text").text=m.Values[1][1]
|
Util.GetGameObject(listPre[n].gameObject,"progress"):GetComponent("Text").text=m.Values[1][1]
|
||||||
if n==1 then
|
|
||||||
listPre[n].transform:GetComponent("RectTransform").anchoredPosition3D = Vector3.zero
|
|
||||||
position = 0
|
|
||||||
else
|
|
||||||
local tempinterval = (m.Values[1][1] - tmp) / count * interval
|
local tempinterval = (m.Values[1][1] - tmp) / count * interval
|
||||||
|
if n==1 then
|
||||||
|
position = tempinterval
|
||||||
|
else
|
||||||
position = tempinterval + width + position
|
position = tempinterval + width + position
|
||||||
listPre[n].transform:GetComponent("RectTransform").anchoredPosition3D=Vector3.New(position,0,0)
|
|
||||||
end
|
end
|
||||||
|
listPre[n].transform:GetComponent("RectTransform").anchoredPosition3D=Vector3.New(position,0,0)
|
||||||
tmp=m.Values[1][1]
|
tmp=m.Values[1][1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function RewardPreview:CalculateInterval(count)
|
||||||
|
local curActivityId=ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
|
||||||
|
local data= ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",curActivityId)
|
||||||
|
local interval = 0
|
||||||
|
LogBlue(#data)
|
||||||
|
for n,m in ipairs(data) do
|
||||||
|
LogBlue(n.." "..m.Values[1][1])
|
||||||
|
end
|
||||||
|
if count>=data[1].Values[1][1] then
|
||||||
|
interval=0.099
|
||||||
|
if count>=data[2].Values[1][1] then
|
||||||
|
interval=0.3
|
||||||
|
if count>=data[3].Values[1][1] then
|
||||||
|
interval=0.54
|
||||||
|
if count>=data[4].Values[1][1] then
|
||||||
|
interval=0.75
|
||||||
|
if count>=data[5].Values[1][1] then
|
||||||
|
interval=1
|
||||||
|
else
|
||||||
|
interval = 0.75+ (count - data[4].Values[1][1]) * (1-0.75)/(data[5].Values[1][1]-data[4].Values[1][1])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
interval = 0.54+ (count -data[3].Values[1][1])*(0.75-0.54)/(data[4].Values[1][1]-data[3].Values[1][1])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
interval = 0.3+ (count -data[2].Values[1][1])*(0.54-0.3)/(data[3].Values[1][1]-data[2].Values[1][1])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
interval = 0.099+ (count -data[1].Values[1][1])*(0.3-0.099)/(data[2].Values[1][1]-data[1].Values[1][1])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
interval = count*0.001
|
||||||
|
end
|
||||||
|
return interval
|
||||||
|
end
|
||||||
|
|
||||||
function RewardPreview:OnHide()
|
function RewardPreview:OnHide()
|
||||||
self.gameObject:SetActive(false)
|
self.gameObject:SetActive(false)
|
||||||
data={}
|
data={}
|
||||||
|
|
|
@ -54,8 +54,8 @@ function TimeLimitedCall:InitComponent(gameObject)
|
||||||
self.hero2 = Util.GetGameObject(self.gameObject,"Bg/hero2")
|
self.hero2 = Util.GetGameObject(self.gameObject,"Bg/hero2")
|
||||||
self.hero3 = Util.GetGameObject(self.gameObject,"Bg/hero3")
|
self.hero3 = Util.GetGameObject(self.gameObject,"Bg/hero3")
|
||||||
|
|
||||||
self.recruitTimeUpdate = Util.GetGameObject(self.gameObject,"recruitTimesUpdate/Text") :GetComponent("Text")
|
self.recruitTimeUpdate = Util.GetGameObject(self.gameObject,"recruitTimesUpdate/Text1") :GetComponent("Text") --时间
|
||||||
self.recruitTimesUpdate = Util.GetGameObject(self.gameObject,"recruitTimesUpdate/Text1") :GetComponent("Text")
|
self.recruitTimesUpdate = Util.GetGameObject(self.gameObject,"recruitTimesUpdate/Text") :GetComponent("Text") --剩余次数
|
||||||
end
|
end
|
||||||
|
|
||||||
function TimeLimitedCall:BindEvent()
|
function TimeLimitedCall:BindEvent()
|
||||||
|
@ -66,7 +66,7 @@ function TimeLimitedCall:BindEvent()
|
||||||
Util.AddClick(self.activityBtn, function()
|
Util.AddClick(self.activityBtn, function()
|
||||||
secectTab=1
|
secectTab=1
|
||||||
self:RefreshTabBtn()
|
self:RefreshTabBtn()
|
||||||
ActivityDetail.new(self.detail)
|
ActivityDetail.new(self.detail,1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Util.AddClick(self.rewardBtn, function()
|
Util.AddClick(self.rewardBtn, function()
|
||||||
|
@ -183,10 +183,37 @@ function TimeLimitedCall:RefreshNextLevelReward()
|
||||||
RewardPreview.new(self.reward)
|
RewardPreview.new(self.reward)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local reMaintimes = ActivityGiftManager.GetActivityValueInfo(curActivityId)
|
||||||
|
LogBlue(ConfigManager.GetConfigData(ConfigName.LotterySpecialConfig,18).Count)
|
||||||
|
reMaintimes = ConfigManager.GetConfigData(ConfigName.LotterySpecialConfig,18).Count - reMaintimes
|
||||||
|
LogBlue("reMaintimes:"..reMaintimes)
|
||||||
|
self.recruitTimesUpdate.text = string.format("召唤<color=#F27D0F>%s</color>次必得UP神将",reMaintimes)
|
||||||
|
|
||||||
|
local info= ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FindFairy)
|
||||||
|
LogBlue(info.endTime)
|
||||||
|
LogBlue(info.startTime)
|
||||||
|
info = info.endTime - info.startTime
|
||||||
|
info = self:TimeToDHMS(info)
|
||||||
|
self.recruitTimeUpdate.text = string.format("活动剩余时间:"..info)
|
||||||
|
end
|
||||||
|
--- 将一段时间转换为天时分秒
|
||||||
|
function TimeLimitedCall:TimeToDHMS(second)
|
||||||
|
local day = math.floor(second / (24 * 3600))
|
||||||
|
local minute = math.floor(second / 60) % 60
|
||||||
|
local sec = second % 60
|
||||||
|
local hour = math.floor(math.floor(second - day * 24 * 3600 - sec - minute * 60) / 3600)
|
||||||
|
if day <= 0 and hour <= 0 then
|
||||||
|
return string.format("%s分%s秒",minute, sec)
|
||||||
|
else
|
||||||
|
return string.format("%s天%s小时",day, hour)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TimeLimitedCall:GetMissionStateById(num,activityId)
|
function TimeLimitedCall:GetMissionStateById(num,activityId)
|
||||||
|
LogBlue("activityId:"..activityId.. ",num:"..num)
|
||||||
local mission= ActivityGiftManager.GetActivityInfo(activityId,num) --从后端获取到的阶段数据
|
local mission= ActivityGiftManager.GetActivityInfo(activityId,num) --从后端获取到的阶段数据
|
||||||
|
LogBlue(mission.progress.." "..mission.state)
|
||||||
return mission.progress,mission.state
|
return mission.progress,mission.state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue