Advertisement
Lonely_Wanderer

uiachievement

Feb 12th, 2024 (edited)
1,006
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 66.40 KB | None | 0 0
  1. local UIAnim = require "widgets/uianim"
  2. local Text = require "widgets/text"
  3. local Widget = require "widgets/widget"
  4. local Image = require "widgets/image"
  5. local ImageButton = require "widgets/imagebutton"
  6. local AnimButton = require "widgets/animbutton"
  7. local HoverText = require "widgets/hoverer"
  8. local achievement_config = require("Achievement.achievement_config")
  9. local achievement_ability_config = require("Achievement.achievement_ability_config")
  10. local id2ability = achievement_ability_config.id2ability
  11.  
  12. local modname = KnownModIndex:GetModActualName("New Achivement")
  13. local killAmountFinishAchievement = GetModConfigData("killamount_can_finish_achievement",modname)
  14. local uiachievement = Class(Widget, function(self, owner)
  15.     Widget._ctor(self, "uiachievement")
  16.     self.owner = owner
  17.     self.mainui = self:AddChild(Widget("mainui"))
  18.     self.mainui:SetScale(1.06, 1.06, 1)
  19.     self.mainui.bg = self.mainui:AddChild(Image("images/quagmire_recipebook.xml", "quagmire_recipe_menu_bg.tex"))
  20.     self.mainui.bg:SetPosition(0, 20, 0)
  21.     self.mainui.bg:MoveToFront()
  22.     self.mainui.bg:ScaleToSize(1253, 783)
  23.     self.mainui.bg:Hide()
  24.  
  25.     self.mainui.bg.allachiv = self.mainui.bg:AddChild(Widget("allachiv"))
  26.     self.mainui.bg.allachiv:SetPosition(0, 0, 0)
  27.     self.mainui.bg.allachiv:Hide()
  28.  
  29.     self.mainui.bg.allcoin = self.mainui.bg:AddChild(Widget("allcoin"))
  30.     self.mainui.bg.allcoin:SetPosition(0, 0, 0)
  31.     self.mainui.bg.allcoin:Hide()
  32.  
  33.     --图鉴
  34.     self.mainui.bg.allchart = self.mainui.bg:AddChild(Widget("allchart"))
  35.     self.mainui.bg.allchart:SetPosition(0, 0, 0)
  36.     self.mainui.bg.allchart:Hide()
  37.     --3个分类
  38.     self.mainui.bg.title_1 = self.mainui.bg:AddChild(ImageButton("images/quagmire_recipebook.xml", "quagmire_recipe_tab_active.tex"))
  39.     self.mainui.bg.title_1:SetPosition(-365, 420, 0)
  40.     self.mainui.bg.title_1:SetNormalScale(1,1,1)
  41.     self.mainui.bg.title_1:SetFocusScale(1,1,1)
  42.     --成就bt
  43.     self.mainui.bg.title_1:SetOnClick(function()
  44.         self.mainui.bg.title_1:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_active.tex")
  45.         self.mainui.bg.title_2:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  46.         self.mainui.bg.title_3:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  47.         --------------------------------
  48.         if not self.mainui.bg.allachiv.shown then
  49.             self.mainui.bg.allachiv:Show()
  50.             self.mainui.bg:Show()
  51.             self.mainui.infobutton:Show()
  52.             self.mainui.itemclassification:Show()
  53.             self.mainui.bg.allcoin:Hide()
  54.             self.mainui.bg.allchart:Hide()
  55.  
  56.             self.mainui.infobutton.last:Show()
  57.             self.mainui.infobutton.next:Show()
  58.  
  59.             self.mainui.infobutton.last2:Hide()
  60.             self.mainui.infobutton.next2:Hide()
  61.             self.mainui.infobutton.last3:Hide()
  62.             self.mainui.infobutton.next3:Hide()
  63.             self.mainui.infobutton.info:Hide()
  64.             self.mainui.infobutton.desc:Hide()
  65.         end
  66.         self.maxnumpage = math.ceil(#self.listitem/14)
  67.         if self.numpage == 1 then
  68.             self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  69.         else
  70.             self.mainui.infobutton.last:SetTextures("images/button/last_act.xml", "last_act.tex")
  71.         end
  72.         if self.numpage >= self.maxnumpage then
  73.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  74.         else
  75.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  76.         end
  77.  
  78.     end)
  79.     self.mainui.bg.title_1.lable = self.mainui.bg.title_1:AddChild(Text(NEWFONT_OUTLINE, 50, STRINGS.ALLACHIVUISTRING[1]))
  80.     self.mainui.bg.title_1.lable:SetPosition(0, -5, 0)
  81.  
  82.     self.mainui.bg.title_2 = self.mainui.bg:AddChild(ImageButton("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex"))
  83.     self.mainui.bg.title_2:SetPosition(0, 420, 0)
  84.     self.mainui.bg.title_2:SetNormalScale(1,1,1)
  85.     self.mainui.bg.title_2:SetFocusScale(1,1,1)
  86.     --能力BT
  87.     self.mainui.bg.title_2:SetOnClick(function()
  88.  
  89.         self.mainui.bg.title_1:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  90.         self.mainui.bg.title_2:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_active.tex")
  91.         self.mainui.bg.title_3:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  92.  
  93.         if not self.mainui.bg.allcoin.shown then
  94.             if  TUNING.CHECKCOIN then
  95.                 self.mainui.bg.allcoin:Hide()
  96.             else
  97.                 self.mainui.bg.allcoin:Show()
  98.             end
  99.             self.mainui.bg:Show()
  100.             self.mainui.infobutton:Show()
  101.                
  102.             self.mainui.itemclassification:Hide()
  103.                
  104.             self.mainui.bg.allachiv:Hide()
  105.             self.mainui.bg.allchart:Hide()
  106.             self.mainui.infobutton.last:Hide()
  107.             self.mainui.infobutton.next:Hide()
  108.             self.mainui.infobutton.last3:Hide()
  109.             self.mainui.infobutton.next3:Hide()
  110.             self.mainui.infobutton.last2:Show()
  111.             self.mainui.infobutton.next2:Show()
  112.             self.mainui.infobutton.info:Hide()
  113.             self.mainui.infobutton.desc:Hide()
  114.         end
  115.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  116.         self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  117.  
  118.         self.maxnumpage2 = math.ceil(#self.coinlist/28)
  119.         if self.numpage2 == 1 then
  120.             self.mainui.infobutton.last2:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  121.         else
  122.             self.mainui.infobutton.last2:SetTextures("images/button/last_act.xml", "last_act.tex")
  123.         end
  124.         if self.numpage2 >= self.maxnumpage2 then
  125.             self.mainui.infobutton.next2:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  126.         else
  127.             self.mainui.infobutton.next2:SetTextures("images/button/next_act.xml", "next_act.tex")
  128.         end
  129.        
  130.     end)
  131.  
  132.     self.mainui.bg.title_2.lable = self.mainui.bg.title_2:AddChild(Text(NEWFONT_OUTLINE, 50, STRINGS.ALLACHIVUISTRING[2]))
  133.     self.mainui.bg.title_2.lable:SetPosition(0, -5, 0)
  134.  
  135.     self.mainui.bg.title_3 = self.mainui.bg:AddChild(ImageButton("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex"))
  136.     self.mainui.bg.title_3:SetPosition(365, 420, 0)
  137.     self.mainui.bg.title_3:SetNormalScale(1,1,1)
  138.     self.mainui.bg.title_3:SetFocusScale(1,1,1)
  139.     --图鉴BT
  140.     self.mainui.bg.title_3:SetOnClick(function()
  141.         self.mainui.bg.title_1:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  142.         self.mainui.bg.title_2:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  143.         self.mainui.bg.title_3:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_active.tex")
  144.  
  145.         if not self.mainui.bg.allchart.shown then
  146.             self.mainui.bg.allchart:Show()
  147.             self.mainui.bg:Show()
  148.             self.mainui.infobutton:Show()
  149.                
  150.             self.mainui.itemclassification:Hide()
  151.             self.mainui.bg.allcoin:Hide()
  152.             self.mainui.bg.allachiv:Hide()
  153.             self.mainui.infobutton.last:Hide()
  154.             self.mainui.infobutton.next:Hide()
  155.             self.mainui.infobutton.last2:Hide()
  156.             self.mainui.infobutton.next2:Hide()
  157.  
  158.             self.mainui.infobutton.last3:Show()
  159.             self.mainui.infobutton.next3:Show()
  160.             self.mainui.infobutton.info:Hide()
  161.             self.mainui.infobutton.desc:Hide()
  162.         end
  163.  
  164.  
  165.     end)
  166.     self.mainui.bg.title_3.lable = self.mainui.bg.title_3:AddChild(Text(NEWFONT_OUTLINE, 50, STRINGS.ALLACHIVUISTRING[3]))
  167.     self.mainui.bg.title_3.lable:SetPosition(0, -5, 0)
  168.  
  169.     --线
  170.     self.mainui.bg.line = self.mainui.bg:AddChild(Image("images/quagmire_recipebook.xml", "quagmire_recipe_line_long.tex"))
  171.     self.mainui.bg.line:SetPosition(0, 325, 0)
  172.  
  173.     --成就点 显示
  174.     self.mainui.bg.coinamount = self.mainui.bg:AddChild(Text(NEWFONT_OUTLINE, 45,string.format(STRINGS.ACHIEVEMENT_POINT_AMOUNT, self.owner.currentcoinamount:value())))
  175.     self.mainui.bg.coinamount:SetPosition(-180, 350, 0)
  176.     --杀戮值
  177.     self.mainui.bg.killamount = self.mainui.bg:AddChild(Text(NEWFONT_OUTLINE, 45, string.format(STRINGS.ACHIEVEMENT_KILL_AMOUNT, self.owner.currentkillamount:value())))
  178.     self.mainui.bg.killamount:SetPosition(180, 350, 0)
  179.  
  180.     self.mainbutton = self:AddChild(Widget("mainbutton"))
  181.     self.mainbutton:SetPosition(-850, 460, 0)
  182.     self.mainbutton:SetScale(1,1,1)
  183.  
  184.     self.mainbutton.checkbuttonglow = self.mainbutton:AddChild(Image("images/button/checkbuttonglow.xml", "checkbuttonglow.tex"))
  185.     self.mainbutton.checkbuttonglow:SetClickable(false)
  186.     self.mainbutton.checkbuttonglow:Hide()
  187.  
  188. --多少任务
  189.     self.mainbutton.checkbutton = self.mainbutton:AddChild(ImageButton("images/button/checkbutton.xml", "checkbutton.tex"))
  190.     self.mainbutton.checkbutton:MoveToFront()
  191.     self.mainbutton.checkbutton:SetHoverText(STRINGS.ACHIEVEMENT_VIEW)
  192.  
  193.     self.mainbutton.checkbutton:SetOnGainFocus(function() self.mainbutton.checkbuttonglow:Show() end)
  194.     self.mainbutton.checkbutton:SetOnLoseFocus(function() self.mainbutton.checkbuttonglow:Hide() end)
  195.     self.cooldown = true
  196.     self.mainbutton.checkbutton:SetOnClick(function()
  197.         if TheInput:IsKeyDown(KEY_ALT) and TheInput:IsKeyDown(KEY_SHIFT) then
  198.             if self.cooldown then
  199.                 local allnumber = #self.achivlist - 1
  200.                 if  not TheInput:IsKeyDown(KEY_CTRL) then
  201.                     TheNet:Say(STRINGS.LMB ..string.format(STRINGS.ACHIEVEMENT_PROCESS,self.achivlist[#self.achivlist].current,allnumber), false)
  202.                 else
  203.                     if  TheInput:IsKeyDown(KEY_CTRL) then
  204.                         TheNet:Say(STRINGS.LMB .. string.format(STRINGS.ACHIEVEMENT_PROCESS ,self.achivlist[#self.achivlist].current,allnumber), true)
  205.                     end
  206.                 end
  207.                 self.cooldown = false
  208.                 self.owner:DoTaskInTime(3, function() self.cooldown = true end)
  209.             end
  210.         else
  211.             if self.mainui.bg.allachiv.shown then
  212.                 self.mainui.bg.allachiv:Hide()
  213.                 self.mainui.bg:Hide()
  214.                 self.mainui.infobutton:Hide()
  215.                 self.mainui.itemclassification:Hide()
  216.                 --self.mainbutton.configact:Hide()
  217.                 self.mainbutton.configbg:Hide()
  218.                 self.mainbutton.configbigger:Hide()
  219.                 self.mainbutton.configsmaller:Hide()
  220.                 self.mainbutton.configremove:Hide()
  221.                 self.mainbutton.removeinfo:Hide()
  222.                 self.mainbutton.removeyes:Hide()
  223.                 self.mainbutton.removeno:Hide()
  224.             else
  225.                 self.mainui.bg.allachiv:Show()
  226.                 self.mainui.bg:Show()
  227.                 self.mainui.infobutton:Show()
  228.                 self.mainui.itemclassification:Show()
  229.                 self.mainui.bg.allcoin:Hide()
  230.                 self.mainui.infobutton.last:Show()
  231.                 self.mainui.infobutton.next:Show()
  232.                 self.mainui.infobutton.last2:Hide()
  233.                 self.mainui.infobutton.next2:Hide()
  234.                 self.mainui.infobutton.last3:Hide()
  235.                 self.mainui.infobutton.next3:Hide()
  236.  
  237.                 self.mainui.bg.title_1:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_active.tex")
  238.                 self.mainui.bg.title_2:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  239.                 self.mainui.bg.title_3:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  240.  
  241.                 if TUNING.CHECKCOIN then
  242.                     --self.mainbutton.configact:Hide()
  243.                 else
  244.                     if self.mainbutton.configact.shown then
  245.                         self.mainbutton.configact:Show()
  246.                     else
  247.                         self.mainbutton.configact:SetTextures("images/button/config_dact.xml", "config_dact.tex")
  248.                         self.mainbutton.configact:Show()
  249.                     end
  250.                 end
  251.  
  252.             end
  253.             self.maxnumpage = math.ceil(#self.listitem/14)
  254.             if self.numpage == 1 then
  255.                 self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  256.             else
  257.                 self.mainui.infobutton.last:SetTextures("images/button/last_act.xml", "last_act.tex")
  258.             end
  259.             if self.numpage >= self.maxnumpage then
  260.                 self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  261.             else
  262.                 self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  263.             end
  264.         end
  265.     end)
  266.  
  267.     self.mainbutton.coinbuttonglow = self.mainbutton:AddChild(Image("images/button/coinbuttonglow.xml", "coinbuttonglow.tex"))
  268.     self.mainbutton.coinbuttonglow:SetClickable(false)
  269.     self.mainbutton.coinbuttonglow:Hide()
  270.     self.mainbutton.coinbuttonglow:SetPosition(55, -2, 0)
  271.     self.mainbutton.coinbuttonglow:SetScale(1,1,1)
  272. --多少 点
  273.     self.mainbutton.coinbutton = self.mainbutton:AddChild(ImageButton("images/button/coinbutton.xml", "coinbutton.tex"))
  274.     self.mainbutton.coinbutton:MoveToFront()
  275.     self.mainbutton.coinbutton:SetPosition(55, -2, 0)
  276.     self.mainbutton.coinbutton:SetScale(1,1,1)
  277.     self.mainbutton.coinbutton:SetHoverText(STRINGS.ACHIEVEMENT_EXCHANGE_ABILITY)
  278.  
  279.     self.mainbutton.coinbutton:SetOnGainFocus(function() self.mainbutton.coinbuttonglow:Show() end)
  280.     self.mainbutton.coinbutton:SetOnLoseFocus(function() self.mainbutton.coinbuttonglow:Hide() end)
  281.  
  282.     if TUNING.CHECKCOIN then
  283.         self.mainbutton.coinbutton:Hide()
  284.     end
  285.     self.mainbutton.coinbutton:SetOnClick(function()
  286.         if TheInput:IsKeyDown(KEY_ALT) and TheInput:IsKeyDown(KEY_SHIFT) then
  287.             if self.cooldown then
  288.                 local emoji_link = " "
  289.                 local announce = 1
  290.                 if self.owner.currentcoinamount:value() < 20 then
  291.                     if TheInventory:CheckOwnership("emoji_lightbulb") then emoji_link = ":lightbulb:" end
  292.                     announce = 1
  293.                 elseif self.owner.currentcoinamount:value() >= 20 and  self.owner.currentcoinamount:value() <= 50 then
  294.                     if TheInventory:CheckOwnership("emoji_thumbsup") then emoji_link = ":thumbsup:" end
  295.                     announce = 2
  296.                 elseif self.owner.currentcoinamount:value() > 50 and  self.owner.currentcoinamount:value() < 90 then
  297.                     announce = 3
  298.                     if TheInventory:CheckOwnership("emoji_flex") then emoji_link = ":flex:" end
  299.                 else
  300.                     announce = 4
  301.                     if TheInventory:CheckOwnership("emoji_fire") then emoji_link = ":fire:" end
  302.                 end
  303.                 TheNet:Say(STRINGS.LMB .. string.format(STRINGS.ACHIEVEMENT_ANNOUNCE_POINT[announce], self.owner.currentcoinamount:value())..emoji_link .. string.format(STRINGS.ACHIEVEMENT_KILL_AMOUNT, self.owner.currentkillamount:value()), false)
  304.                 self.cooldown = false
  305.                 self.owner:DoTaskInTime(3, function() self.cooldown = true end)
  306.             end
  307.         else
  308.             if self.mainui.bg.allcoin.shown then
  309.                 self.mainui.bg.allcoin:Hide()
  310.                 self.mainui.bg:Hide()
  311.                 self.mainui.infobutton:Hide()
  312.                 self.mainui.itemclassification:Hide()
  313.                 --self.mainbutton.configact:Hide()
  314.  
  315.                 self.mainbutton.configbg:Hide()
  316.                 self.mainbutton.configbigger:Hide()
  317.                 self.mainbutton.configsmaller:Hide()
  318.                 self.mainbutton.configremove:Hide()
  319.                 self.mainbutton.removeinfo:Hide()
  320.                 self.mainbutton.removeyes:Hide()
  321.                 self.mainbutton.removeno:Hide()
  322.             else
  323.                 self.mainui.bg.allcoin:Show()
  324.                 self.mainui.bg:Show()
  325.                 self.mainui.infobutton:Show()
  326.                
  327.                 self.mainui.itemclassification:Hide()
  328.                
  329.                 self.mainui.bg.allachiv:Hide()
  330.                 self.mainui.infobutton.last:Hide()
  331.                 self.mainui.infobutton.next:Hide()
  332.  
  333.                 self.mainui.infobutton.last2:Show()
  334.                 self.mainui.infobutton.next2:Show()
  335.  
  336.                 self.mainui.infobutton.last3:Hide()
  337.                 self.mainui.infobutton.next3:Hide()
  338.  
  339.                 self.mainui.bg.title_2:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_active.tex")
  340.                 self.mainui.bg.title_1:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  341.                 self.mainui.bg.title_3:SetTextures("images/quagmire_recipebook.xml", "quagmire_recipe_tab_inactive.tex")
  342.                
  343.  
  344.                 if TUNING.CHECKCOIN then
  345.                     --self.mainbutton.configact:Hide()
  346.                 else
  347.                     if self.mainbutton.configact.shown  then
  348.                         self.mainbutton.configact:Show()
  349.                     else
  350.                         self.mainbutton.configact:SetTextures("images/button/config_dact.xml", "config_dact.tex")
  351.                         self.mainbutton.configact:Show()
  352.                     end
  353.                 end
  354.             end
  355.             self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  356.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  357.  
  358.             self.maxnumpage2 = math.ceil(#self.coinlist/28)
  359.             if self.numpage2 == 1 then
  360.                 self.mainui.infobutton.last2:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  361.             else
  362.                 self.mainui.infobutton.last2:SetTextures("images/button/last_act.xml", "last_act.tex")
  363.             end
  364.  
  365.             if self.numpage2 >= self.maxnumpage2 then
  366.                 self.mainui.infobutton.next2:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  367.             else
  368.                 self.mainui.infobutton.next2:SetTextures("images/button/next_act.xml", "next_act.tex")
  369.             end
  370.         end
  371.     end)
  372.  
  373.     self.mainbutton.configbg = self.mainbutton:AddChild(Image("images/button/config_bg.xml", "config_bg.tex"))
  374.     self.mainbutton.configbg:SetPosition(193, -5, 0)
  375.     self.mainbutton.configbg:SetClickable(false)
  376.     self.mainbutton.configbg:Hide()
  377.  
  378.  
  379.     self.mainbutton.configact = self.mainbutton:AddChild(ImageButton("images/button/config_dact.xml", "config_dact.tex"))
  380.     self.mainbutton.configact:SetPosition(115, -5, 0)
  381.     self.mainbutton.configact:SetNormalScale(1,1,1)
  382.     self.mainbutton.configact:SetFocusScale(1.1,1.1,1)
  383.     self.mainbutton.configact:SetHoverText(STRINGS.ACHIEVEMENT_OPTION)
  384.  
  385.     if TUNING.CHECKCOIN then
  386.         --self.mainbutton.configact:Hide()
  387.     end
  388.  
  389.     --self.mainbutton.configact:Hide()
  390.  
  391.     self.mainbutton.configact:SetOnClick(function()
  392.         if self.mainbutton.configbg.shown then
  393.             self.mainbutton.configact:SetTextures("images/button/config_dact.xml", "config_dact.tex")
  394.             self.mainbutton.configbg:Hide()
  395.             self.mainbutton.configbigger:Hide()
  396.             self.mainbutton.configsmaller:Hide()
  397.             self.mainbutton.configremove:Hide()
  398.         else
  399.             self.mainbutton.configact:SetTextures("images/button/config_act.xml", "config_act.tex")
  400.             self.mainbutton.configbg:Show()
  401.             self.mainbutton.configbigger:Show()
  402.             self.mainbutton.configsmaller:Show()
  403.             self.mainbutton.configremove:Show()
  404.         end
  405.         self.mainbutton.removeinfo:Hide()
  406.         self.mainbutton.removeyes:Hide()
  407.         self.mainbutton.removeno:Hide()
  408.     end)
  409.  
  410.     self.size = 1.06
  411.     self.mainbutton.configbigger = self.mainbutton:AddChild(ImageButton("images/button/config_bigger.xml", "config_bigger.tex"))
  412.     self.mainbutton.configbigger:SetPosition(167, -5, 0)
  413.     self.mainbutton.configbigger:Hide()
  414.     self.mainbutton.configbigger:SetNormalScale(1,1,1)
  415.     self.mainbutton.configbigger:SetFocusScale(1.1,1.1,1)
  416.     self.mainbutton.configbigger:SetHoverText(STRINGS.ACHIEVEMENT_ENLARGE)
  417.     self.mainbutton.configbigger:SetOnClick(function()
  418.         if not self.mainui.bg.allachiv.shown and not self.mainui.bg.allcoin.shown then
  419.             self.mainui.bg.allachiv:Show()
  420.             self.mainui.bg:Show()
  421.             self.mainui.infobutton:Show()
  422.         end
  423.         self.size = self.size + .02
  424.         self.mainui:SetScale(self.size, self.size, 1)
  425.     end)
  426.  
  427.     self.mainbutton.configsmaller = self.mainbutton:AddChild(ImageButton("images/button/config_smaller.xml", "config_smaller.tex"))
  428.     self.mainbutton.configsmaller:SetPosition(219, -5, 0)
  429.     self.mainbutton.configsmaller:Hide()
  430.     self.mainbutton.configsmaller:SetNormalScale(1,1,1)
  431.     self.mainbutton.configsmaller:SetFocusScale(1.1,1.1,1)
  432.     self.mainbutton.configsmaller:SetHoverText(STRINGS.ACHIEVEMENT_SHRINK)
  433.     self.mainbutton.configsmaller:SetOnClick(function()
  434.         if not self.mainui.bg.allachiv.shown and not self.mainui.bg.allcoin.shown then
  435.             self.mainui.bg.allachiv:Show()
  436.             self.mainui.bg:Show()
  437.             self.mainui.infobutton:Show()
  438.         end
  439.         if self.size > .02 then
  440.             self.size = self.size - .02
  441.         end
  442.         self.mainui:SetScale(self.size, self.size, 1)
  443.     end)
  444.     self.mainbutton.removeinfo = self.mainbutton:AddChild(Image("images/button/remove_info_cn.xml", "remove_info_cn.tex"))
  445.     self.mainbutton.removeinfo:SetPosition(230, -180, 0)
  446.     self.mainbutton.removeinfo:SetScale(.95,.95,1)
  447.    
  448.     self.mainbutton.removeinfo.title = self.mainbutton.removeinfo:AddChild(Text(NEWFONT_OUTLINE, 45, STRINGS.ALLACHIEVE_RESET_CONFIRM))
  449.     self.mainbutton.removeinfo.title:SetPosition(-90, 110, 0)
  450.     self.mainbutton.removeinfo.title:SetColour(1, 0, 0, 1)
  451.  
  452.     self.mainbutton.removeinfo.lable = self.mainbutton.removeinfo:AddChild(Text(NEWFONT_OUTLINE, 30, string.format(STRINGS.ALLACHIEVE_RESET,TUNING.RETRUN_POINT * 100)))
  453.     self.mainbutton.removeinfo.lable:SetPosition(-80, 80, 0)
  454.     self.mainbutton.removeinfo.lable:SetRegionSize(300,80)
  455.     self.mainbutton.removeinfo:Hide()
  456.     self.mainbutton.configremove = self.mainbutton:AddChild(ImageButton("images/button/config_remove.xml", "config_remove.tex"))
  457.     self.mainbutton.configremove:SetPosition(271, -5, 0)
  458.     self.mainbutton.configremove:Hide()
  459.     self.mainbutton.configremove:SetNormalScale(1,1,1)
  460.     self.mainbutton.configremove:SetFocusScale(1.1,1.1,1)
  461.     self.mainbutton.configremove:SetHoverText(STRINGS.ACHIEVEMENT_RESET)
  462.     self.mainbutton.configremove:SetOnClick(function()
  463.         self.mainbutton.removeinfo:Show()
  464.         self.mainbutton.removeyes:Show()
  465.         self.mainbutton.removeno:Show()
  466.     end)
  467.  
  468.     self.mainbutton.removeyes = self.mainbutton:AddChild(ImageButton("images/button/remove_yes.xml", "remove_yes.tex"))
  469.     self.mainbutton.removeyes:SetPosition(17, -77, 0)
  470.     self.mainbutton.removeyes:Hide()
  471.     self.mainbutton.removeyes:SetNormalScale(1,1,1)
  472.     self.mainbutton.removeyes:SetFocusScale(1.1,1.1,1)
  473.     self.mainbutton.removeyes:SetOnClick(function()
  474.         SendModRPCToServer(MOD_RPC["DSTAchievement"]["removecoin"])
  475.         self.owner:DoTaskInTime(.35, function()
  476.             self:loadcoinlist()
  477.             self:coinbuild()
  478.         end)
  479.         self.mainbutton.removeinfo:Hide()
  480.         self.mainbutton.removeyes:Hide()
  481.         self.mainbutton.removeno:Hide()
  482.  
  483.         self.mainui.bg.allcoin:Hide()
  484.         self.mainui.bg:Hide()
  485.         self.mainui.infobutton:Hide()
  486.         self.mainui.itemclassification:Hide()
  487.         self.mainui.bg.allachiv:Hide()
  488.  
  489.         --self.mainbutton.configact:Hide()
  490.         self.mainbutton.configbg:Hide()
  491.         self.mainbutton.configbigger:Hide()
  492.         self.mainbutton.configsmaller:Hide()
  493.         self.mainbutton.configremove:Hide()
  494.     end)
  495.  
  496.     self.mainbutton.removeno = self.mainbutton:AddChild(ImageButton("images/button/remove_no.xml", "remove_no.tex"))
  497.     self.mainbutton.removeno:SetPosition(257, -77, 0)
  498.     self.mainbutton.removeno:Hide()
  499.     self.mainbutton.removeno:SetNormalScale(1,1,1)
  500.     self.mainbutton.removeno:SetFocusScale(1.1,1.1,1)
  501.     self.mainbutton.removeno:SetOnClick(function()
  502.         self.mainbutton.removeinfo:Hide()
  503.         self.mainbutton.removeyes:Hide()
  504.         self.mainbutton.removeno:Hide()
  505.     end)
  506.  
  507.     self.mainui.infobutton = self.mainui:AddChild(Widget("infobutton"))
  508.     self.mainui.infobutton:SetPosition(240, -30, 0)
  509.     self.mainui.infobutton:Hide()
  510.  
  511.     self.mainui.infobutton.info = self.mainui.infobutton:AddChild(Image("images/quagmire_recipebook.xml", "quagmire_recipe_menu_bg.tex"))
  512.     self.mainui.infobutton.info:SetPosition(-240, 50, 0)
  513.     self.mainui.bg:ScaleToSize(1253, 783)
  514.     self.mainui.infobutton.info:Hide()
  515.  
  516.     self.mainui.infobutton.desc = self.mainui.infobutton:AddChild(Text(NEWFONT, 36, STRINGS.ALLACHIVINFODESC[1] ))
  517.     self.mainui.infobutton.desc:SetColour(0, 0, 0, 1)
  518.     self.mainui.infobutton.desc:SetPosition(-210, 10, 0)
  519.     self.mainui.infobutton.desc:SetHAlign(ANCHOR_LEFT)
  520.     self.mainui.infobutton.desc:SetRegionSize(960,680)
  521.     self.mainui.infobutton.desc:Hide()
  522.    
  523.  
  524.     self.mainui.infobutton.question = self.mainui.infobutton:AddChild(ImageButton("images/button/infobutton.xml", "infobutton.tex"))
  525.     self.mainui.infobutton.question:SetPosition(40, -370, 0)
  526.     self.mainui.infobutton.question:SetOnClick(function()
  527.         if self.mainui.infobutton.info.shown then
  528.             self.mainui.infobutton.info:Hide()
  529.             self.mainui.infobutton.desc:Hide()
  530.         else
  531.             self.mainui.infobutton.info:Show()
  532.             self.mainui.infobutton.desc:Show()
  533.         end
  534.     end)
  535.  
  536.     self.mainui.infobutton.last = self.mainui.infobutton:AddChild(ImageButton("images/button/last_dact.xml", "last_dact.tex"))
  537.     self.mainui.infobutton.last:SetPosition(98, -370, 0)
  538.     self.mainui.infobutton.last:SetOnClick(function()
  539.         if self.numpage > 1 and self.mainui.bg.allachiv.shown then
  540.             self.numpage = self.numpage - 1
  541.             self:build()
  542.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  543.         end
  544.         if self.numpage == 1 then
  545.             self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  546.         end
  547.     end)
  548.  
  549.     self.mainui.infobutton.last2 = self.mainui.infobutton:AddChild(ImageButton("images/button/last_dact.xml", "last_dact.tex"))
  550.     self.mainui.infobutton.last2:SetPosition(98, -370, 0)
  551.     self.mainui.infobutton.last2:SetOnClick(function()
  552.         if self.numpage2 > 1 and self.mainui.bg.allcoin.shown then
  553.             self.numpage2 = self.numpage2 - 1
  554.             self:coinbuild()
  555.             self.mainui.infobutton.next2:SetTextures("images/button/next_act.xml", "next_act.tex")
  556.         end
  557.         if self.numpage2 == 1 then
  558.             self.mainui.infobutton.last2:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  559.         end
  560.     end)
  561.     self.mainui.infobutton.next2 = self.mainui.infobutton:AddChild(ImageButton("images/button/next_act.xml", "next_act.tex"))
  562.     self.mainui.infobutton.next2:SetPosition(161, -370, 0)
  563.     self.mainui.infobutton.next2:SetOnClick(function()
  564.  
  565.         if self.numpage2 < self.maxnumpage2 and self.mainui.bg.allcoin.shown then
  566.             self.numpage2 = self.numpage2 + 1
  567.             self:coinbuild()
  568.             self.mainui.infobutton.last2:SetTextures("images/button/last_act.xml", "last_act.tex")
  569.         end
  570.         if self.numpage2 == self.maxnumpage2 then
  571.             self.mainui.infobutton.next2:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  572.         end
  573.     end)
  574.  
  575.     --第3
  576.     self.mainui.infobutton.last3 = self.mainui.infobutton:AddChild(ImageButton("images/button/last_dact.xml", "last_dact.tex"))
  577.     self.mainui.infobutton.last3:SetPosition(98, -370, 0)
  578.    
  579.     self.mainui.infobutton.next3 = self.mainui.infobutton:AddChild(ImageButton("images/button/next_act.xml", "next_act.tex"))
  580.     self.mainui.infobutton.next3:SetPosition(161, -370, 0)
  581.    
  582.     self.mainui.infobutton.next3:SetOnClick(function()
  583.  
  584.     end)
  585.    
  586.     self.mainui.infobutton.next = self.mainui.infobutton:AddChild(ImageButton("images/button/next_act.xml", "next_act.tex"))
  587.     self.mainui.infobutton.next:SetPosition(161, -370, 0)
  588.     self.mainui.infobutton.next:SetOnClick(function()
  589.  
  590.         if self.numpage < self.maxnumpage and self.mainui.bg.allachiv.shown then
  591.             self.numpage = self.numpage + 1
  592.             self:build()
  593.             self.mainui.infobutton.last:SetTextures("images/button/last_act.xml", "last_act.tex")
  594.         end
  595.         if self.numpage == self.maxnumpage then
  596.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  597.         end
  598.     end)
  599.    
  600.    
  601.    
  602.    
  603.     -- My changes, second page of HELP about Abilities  -----------------------------------------
  604.    
  605.     self.mainui.infobutton.info2 = self.mainui.infobutton:AddChild(Image("images/quagmire_recipebook.xml", "quagmire_recipe_menu_bg.tex"))
  606.     self.mainui.infobutton.info2:SetPosition(-240, 50, 0)
  607.     self.mainui.bg:ScaleToSize(1253, 783)
  608.     self.mainui.infobutton.info2:Hide()
  609.    
  610.     self.mainui.infobutton.desc2 = self.mainui.infobutton:AddChild(Text(NEWFONT, 36, STRINGS.ALLACHIVINFODESC[2] ))
  611.     self.mainui.infobutton.desc2:SetColour(0, 0, 0, 1)
  612.     self.mainui.infobutton.desc2:SetPosition(-210, 10, 0)
  613.     self.mainui.infobutton.desc2:SetHAlign(ANCHOR_LEFT)
  614.     self.mainui.infobutton.desc2:SetRegionSize(960,680)
  615.     self.mainui.infobutton.desc2:Hide()
  616.    
  617.  
  618.     self.mainui.infobutton.question2 = self.mainui.infobutton:AddChild(ImageButton("images/button/infobutton.xml", "infobutton.tex"))
  619.     self.mainui.infobutton.question2:SetPosition(0, -370, 0)   
  620.     self.mainui.infobutton.question2:SetOnClick(function()
  621.         if self.mainui.infobutton.info2.shown then
  622.             self.mainui.infobutton.info2:Hide()
  623.             self.mainui.infobutton.desc2:Hide()
  624.         else
  625.             self.mainui.infobutton.info2:Show()
  626.             self.mainui.infobutton.desc2:Show()
  627.         end
  628.     end)
  629.    
  630.     -- End of my changes --------------------------------------------------------------
  631.    
  632.    
  633.    
  634.     self.mainui.infobutton.close = self.mainui.infobutton:AddChild(ImageButton("images/button/close.xml", "close.tex"))
  635.     self.mainui.infobutton.close:SetPosition(220, -370, 0)
  636.     self.mainui.infobutton.close:SetOnClick(function()
  637.         self.mainui.bg.allachiv:Hide()
  638.         self.mainui.bg.allcoin:Hide()
  639.         self.mainui.bg:Hide()
  640.         self.mainui.infobutton:Hide()
  641.         self.mainui.itemclassification:Hide()
  642.  
  643.         --self.mainbutton.configact:Hide()
  644.         self.mainbutton.configbg:Hide()
  645.         self.mainbutton.configbigger:Hide()
  646.         self.mainbutton.configsmaller:Hide()
  647.         self.mainbutton.configremove:Hide()
  648.         self.mainbutton.removeinfo:Hide()
  649.         self.mainbutton.removeyes:Hide()
  650.         self.mainbutton.removeno:Hide()
  651.     end)
  652.  
  653.     --项目分类
  654.     self.mainui.itemclassification = self.mainui:AddChild(Widget("itemclassification"))
  655.     self.mainui.itemclassification:SetPosition(-210, -30, 0)
  656.     self.mainui.itemclassification:Hide()
  657.  
  658.     self.mainui.itemclassification.head = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_head_dact.xml", "item_head_dact.tex"))
  659.     self.mainui.itemclassification.head:SetPosition(-250, -370, 0)
  660.     self.mainui.itemclassification.head:SetOnGainFocus(function() self.mainui.itemclassification.head.item:SetSize(34) end)
  661.     self.mainui.itemclassification.head:SetOnLoseFocus(function() self.mainui.itemclassification.head.item:SetSize(30) end)
  662.     self.mainui.itemclassification.head.item = self.mainui.itemclassification.head:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[1],{0,0,0,1}))
  663.     self.mainui.itemclassification.head.item:SetHAlign(ANCHOR_MIDDLE)
  664.     self.mainui.itemclassification.head.item:SetRegionSize(120,60)
  665.  
  666.     self.mainui.itemclassification.head:SetOnClick(function()
  667.         self.numpage = 1
  668.         self.item = 1
  669.         self:build()
  670.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  671.         self.maxnumpage =  math.ceil(#self.listitem/14)
  672.         if self.numpage == self.maxnumpage then
  673.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  674.         else
  675.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  676.         end
  677.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_dact.xml", "item_head_dact.tex")
  678.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  679.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  680.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  681.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  682.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  683.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  684.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  685.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  686.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  687.     end)
  688.  
  689.     self.mainui.itemclassification.mid2 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  690.     self.mainui.itemclassification.mid2:SetPosition(-120, -370, 0)
  691.     self.mainui.itemclassification.mid2:SetOnGainFocus(function() self.mainui.itemclassification.mid2.item:SetSize(34) end)
  692.     self.mainui.itemclassification.mid2:SetOnLoseFocus(function() self.mainui.itemclassification.mid2.item:SetSize(30) end)
  693.     self.mainui.itemclassification.mid2.item = self.mainui.itemclassification.mid2:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[2],{0,0,0,1}))
  694.     self.mainui.itemclassification.mid2.item:SetHAlign(ANCHOR_MIDDLE)
  695.     self.mainui.itemclassification.mid2.item:SetRegionSize(120,30)
  696.     self.mainui.itemclassification.mid2:SetOnClick(function()
  697.         self.numpage = 1
  698.         self.item = 2
  699.         self:build()
  700.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  701.         self.maxnumpage =  math.ceil(#self.listitem/14)
  702.         if self.numpage == self.maxnumpage then
  703.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  704.         else
  705.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  706.         end
  707.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  708.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  709.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  710.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  711.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  712.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  713.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  714.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  715.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  716.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  717.     end)
  718.  
  719.     self.mainui.itemclassification.mid3 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  720.     self.mainui.itemclassification.mid3:SetPosition(0, -370, 0)
  721.     self.mainui.itemclassification.mid3:SetOnGainFocus(function() self.mainui.itemclassification.mid3.item:SetSize(34) end)
  722.     self.mainui.itemclassification.mid3:SetOnLoseFocus(function() self.mainui.itemclassification.mid3.item:SetSize(30) end)
  723.     self.mainui.itemclassification.mid3.item = self.mainui.itemclassification.mid3:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[3],{0,0,0,1}))
  724.     self.mainui.itemclassification.mid3.item:SetHAlign(ANCHOR_MIDDLE)
  725.     self.mainui.itemclassification.mid3.item:SetRegionSize(120,30)
  726.     self.mainui.itemclassification.mid3:SetOnClick(function()
  727.         self.numpage = 1
  728.         self.item = 3
  729.         self:build()
  730.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  731.         self.maxnumpage =  math.ceil(#self.listitem/14)
  732.         if self.numpage == self.maxnumpage then
  733.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  734.         else
  735.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  736.         end
  737.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  738.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  739.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  740.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  741.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  742.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  743.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  744.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  745.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  746.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  747.     end)
  748.  
  749.     self.mainui.itemclassification.mid4 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  750.     self.mainui.itemclassification.mid4:SetPosition(120, -370, 0)
  751.     self.mainui.itemclassification.mid4:SetOnGainFocus(function() self.mainui.itemclassification.mid4.item:SetSize(34) end)
  752.     self.mainui.itemclassification.mid4:SetOnLoseFocus(function() self.mainui.itemclassification.mid4.item:SetSize(30) end)
  753.     self.mainui.itemclassification.mid4.item = self.mainui.itemclassification.mid4:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[4],{0,0,0,1}))
  754.     self.mainui.itemclassification.mid4.item:SetHAlign(ANCHOR_MIDDLE)
  755.     self.mainui.itemclassification.mid4.item:SetRegionSize(120,30)
  756.     self.mainui.itemclassification.mid4:SetOnClick(function()
  757.         self.numpage = 1
  758.         self.item = 4
  759.         self:build()
  760.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  761.         self.maxnumpage =  math.ceil(#self.listitem/14)
  762.         if self.numpage == self.maxnumpage then
  763.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  764.         else
  765.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  766.         end
  767.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  768.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  769.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  770.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  771.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  772.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  773.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  774.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  775.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  776.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  777.     end)
  778.  
  779.     self.mainui.itemclassification.mid5 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  780.     self.mainui.itemclassification.mid5:SetPosition(240, -370, 0)
  781.     self.mainui.itemclassification.mid5:SetOnGainFocus(function() self.mainui.itemclassification.mid5.item:SetSize(34) end)
  782.     self.mainui.itemclassification.mid5:SetOnLoseFocus(function() self.mainui.itemclassification.mid5.item:SetSize(30) end)
  783.     self.mainui.itemclassification.mid5.item = self.mainui.itemclassification.mid5:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[5],{0,0,0,1}))
  784.     self.mainui.itemclassification.mid5.item:SetHAlign(ANCHOR_MIDDLE)
  785.     self.mainui.itemclassification.mid5.item:SetRegionSize(120,30)
  786.     self.mainui.itemclassification.mid5:SetOnClick(function()
  787.         self.numpage = 1
  788.         self.item = 5
  789.         self:build()
  790.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  791.         self.maxnumpage =  math.ceil(#self.listitem/14)
  792.         if self.numpage == self.maxnumpage then
  793.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  794.         else
  795.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  796.         end
  797.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  798.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  799.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  800.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  801.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  802.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  803.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  804.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  805.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  806.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  807.        
  808.     end)
  809.  
  810.     self.mainui.itemclassification.mid6 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  811.     self.mainui.itemclassification.mid6:SetPosition(360, -370, 0)
  812.     self.mainui.itemclassification.mid6:SetOnGainFocus(function() self.mainui.itemclassification.mid6.item:SetSize(34) end)
  813.     self.mainui.itemclassification.mid6:SetOnLoseFocus(function() self.mainui.itemclassification.mid6.item:SetSize(30) end)
  814.     self.mainui.itemclassification.mid6.item = self.mainui.itemclassification.mid6:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[6],{0,0,0,1}))
  815.     self.mainui.itemclassification.mid6.item:SetHAlign(ANCHOR_MIDDLE)
  816.     self.mainui.itemclassification.mid6.item:SetRegionSize(120,30)
  817.     self.mainui.itemclassification.mid6:SetOnClick(function()
  818.         self.numpage = 1
  819.         self.item = 6
  820.         self:build()
  821.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  822.         self.maxnumpage =  math.ceil(#self.listitem/14)
  823.         if self.numpage == self.maxnumpage then
  824.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  825.         else
  826.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  827.         end
  828.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  829.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  830.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  831.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  832.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  833.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  834.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  835.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  836.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  837.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  838.     end)
  839.  
  840.     self.mainui.itemclassification.mid7 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  841.     self.mainui.itemclassification.mid7:SetPosition(-120, -410, 0)
  842.     self.mainui.itemclassification.mid7:SetOnGainFocus(function() self.mainui.itemclassification.mid7.item:SetSize(34) end)
  843.     self.mainui.itemclassification.mid7:SetOnLoseFocus(function() self.mainui.itemclassification.mid7.item:SetSize(30) end)
  844.     self.mainui.itemclassification.mid7.item = self.mainui.itemclassification.mid7:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[7],{0,0,0,1}))
  845.     self.mainui.itemclassification.mid7.item:SetHAlign(ANCHOR_MIDDLE)
  846.     self.mainui.itemclassification.mid7.item:SetRegionSize(120,30)
  847.     self.mainui.itemclassification.mid7:SetOnClick(function()
  848.         self.numpage = 1
  849.         self.item = 7
  850.         self:build()
  851.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  852.         self.maxnumpage =  math.ceil(#self.listitem/14)
  853.         if self.numpage == self.maxnumpage then
  854.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  855.         else
  856.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  857.         end
  858.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  859.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  860.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  861.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  862.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  863.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  864.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  865.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  866.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  867.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  868.  
  869.     end)
  870.  
  871.     self.mainui.itemclassification.mid8 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  872.     self.mainui.itemclassification.mid8:SetPosition(0, -410, 0)
  873.     self.mainui.itemclassification.mid8:SetOnGainFocus(function() self.mainui.itemclassification.mid8.item:SetSize(34) end)
  874.     self.mainui.itemclassification.mid8:SetOnLoseFocus(function() self.mainui.itemclassification.mid8.item:SetSize(30) end)
  875.     self.mainui.itemclassification.mid8.item = self.mainui.itemclassification.mid8:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[8],{0,0,0,1}))
  876.     self.mainui.itemclassification.mid8.item:SetHAlign(ANCHOR_MIDDLE)
  877.     self.mainui.itemclassification.mid8.item:SetRegionSize(120,30)
  878.     self.mainui.itemclassification.mid8:SetOnClick(function()
  879.         self.numpage = 1
  880.         self.item = 8
  881.         self:build()
  882.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  883.         self.maxnumpage =  math.ceil(#self.listitem/14)
  884.         if self.numpage == self.maxnumpage then
  885.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  886.         else
  887.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  888.         end
  889.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  890.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  891.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  892.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  893.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  894.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  895.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  896.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  897.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  898.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  899.     end)
  900.  
  901.     self.mainui.itemclassification.mid9 = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_mide_act.xml", "item_mide_act.tex"))
  902.     self.mainui.itemclassification.mid9:SetPosition(120, -410, 0)
  903.     self.mainui.itemclassification.mid9:SetOnGainFocus(function() self.mainui.itemclassification.mid9.item:SetSize(34) end)
  904.     self.mainui.itemclassification.mid9:SetOnLoseFocus(function() self.mainui.itemclassification.mid9.item:SetSize(30) end)
  905.     self.mainui.itemclassification.mid9.item = self.mainui.itemclassification.mid9:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[10],{0,0,0,1}))
  906.     self.mainui.itemclassification.mid9.item:SetHAlign(ANCHOR_MIDDLE)
  907.     self.mainui.itemclassification.mid9.item:SetRegionSize(120,30)
  908.     self.mainui.itemclassification.mid9:SetOnClick(function()
  909.         self.numpage = 1
  910.         self.item = 10
  911.         self:build()
  912.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  913.         self.maxnumpage =  math.ceil(#self.listitem/14)
  914.         if self.numpage == self.maxnumpage then
  915.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  916.         else
  917.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  918.         end
  919.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  920.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  921.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  922.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  923.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  924.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  925.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  926.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  927.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_dact.xml", "item_mide_dact.tex")
  928.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_act.xml", "item_tail_act.tex")
  929.        
  930.     end)
  931.  
  932.     self.mainui.itemclassification.tail = self.mainui.itemclassification:AddChild(ImageButton("images/button/item_tail_act.xml", "item_tail_act.tex"))
  933.     self.mainui.itemclassification.tail:SetPosition(240, -410, 0)
  934.     self.mainui.itemclassification.tail:SetOnGainFocus(function() self.mainui.itemclassification.tail.item:SetSize(34) end)
  935.     self.mainui.itemclassification.tail:SetOnLoseFocus(function() self.mainui.itemclassification.tail.item:SetSize(30) end)
  936.     self.mainui.itemclassification.tail.item = self.mainui.itemclassification.tail:AddChild(Text(NEWFONT, 30, STRINGS.ALLACHIVITEM[9],{0,0,0,1}))
  937.     self.mainui.itemclassification.tail.item:SetHAlign(ANCHOR_MIDDLE)
  938.     self.mainui.itemclassification.tail.item:SetRegionSize(120,30)
  939.     self.mainui.itemclassification.tail:SetOnClick(function()
  940.         self.numpage = 1
  941.         self.item = 9
  942.         self:build()
  943.         self.mainui.infobutton.last:SetTextures("images/button/last_dact.xml", "last_dact.tex")
  944.         self.maxnumpage =  math.ceil(#self.listitem/14)
  945.         if self.numpage == self.maxnumpage then
  946.             self.mainui.infobutton.next:SetTextures("images/button/next_dact.xml", "next_dact.tex")
  947.         else
  948.             self.mainui.infobutton.next:SetTextures("images/button/next_act.xml", "next_act.tex")
  949.         end
  950.         self.mainui.itemclassification.head:SetTextures("images/button/item_head_act.xml", "item_head_act.tex")
  951.         self.mainui.itemclassification.mid2:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  952.         self.mainui.itemclassification.mid3:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  953.         self.mainui.itemclassification.mid4:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  954.         self.mainui.itemclassification.mid5:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  955.         self.mainui.itemclassification.mid6:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  956.         self.mainui.itemclassification.mid7:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  957.         self.mainui.itemclassification.mid8:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  958.         self.mainui.itemclassification.mid9:SetTextures("images/button/item_mide_act.xml", "item_mide_act.tex")
  959.         self.mainui.itemclassification.tail:SetTextures("images/button/item_tail_dact.xml", "item_tail_dact.tex")
  960.     end)
  961.     self.inst:DoTaskInTime(.2, function()
  962.         self.numpage = 1
  963.         self.numpage2 = 1
  964.         self:loadlist()
  965.         self:loadcoinlist()
  966.         self.maxnumpage = math.ceil(#self.achivlist/14)
  967.         self.maxnumpage2 = math.ceil(#self.coinlist/28)
  968.         self.achivlistbg = {}
  969.         self.mainui.bg.allachiv.achivlisttile = {}
  970.         self.mainui.bg.allachiv.achivlisttiledsp = {}
  971.         self.mainui.bg.allachiv.achivlistnumber = {}
  972.  
  973.         self.mainui.bg.allachiv.achivlisttiledone = {}
  974.  
  975.         self.item = 1
  976.         self.listitem = {}
  977.  
  978.         self.coinlistbutton = {}
  979.  
  980.         self:build()
  981.         self:coinbuild()
  982.         self:StartUpdating()
  983.     end)
  984. end)
  985.  
  986. function uiachievement:OnUpdate(dt)
  987.     self.mainui.bg.coinamount:SetString(string.format(STRINGS.ACHIEVEMENT_POINT_AMOUNT,self.owner.currentcoinamount:value()))
  988.     self.mainui.bg.killamount:SetString(string.format(STRINGS.ACHIEVEMENT_KILL_AMOUNT,self.owner.currentkillamount:value()))
  989.     self:loadlist()
  990.     self.listitem = {}
  991.     for a = 1, #self.achivlist do
  992.         if self.item == 1 then
  993.             table.insert(self.listitem, self.achivlist[a])
  994.         else
  995.             if self.achivlist[a].item == self.item  then
  996.                 table.insert(self.listitem, self.achivlist[a])
  997.             end
  998.         end
  999.     end
  1000.     for i = 1+14*(self.numpage-1), math.min(#self.listitem, 14*(1+self.numpage-1)) do
  1001.         local check = "dact"
  1002.         --local check = "act"
  1003.         if self.listitem[i].check == 1 then
  1004.             check = "act"
  1005.         end
  1006.         self.mainui.bg.allachiv.achivlisttile[i].image:SetTexture("images/hud/achivbg_"..check..".xml", "achivbg_"..check..".tex")
  1007.  
  1008.         if self.listitem[i].check == 1 then
  1009.             self.mainui.bg.allachiv.achivlisttile[i].desc:SetColour(217/255, 170/255, 83/255, 1)
  1010.             self.mainui.bg.allachiv.achivlisttile[i].nums:SetColour(217/255, 170/255, 83/255, 1)
  1011.             self.mainui.bg.allachiv.achivlisttiledone[i]:Show()
  1012.         else
  1013.             self.mainui.bg.allachiv.achivlisttile[i].desc:SetColour(0, 0, 0, 1)
  1014.             self.mainui.bg.allachiv.achivlisttile[i].nums:SetColour(39/255, 39/255, 39/255, 1)
  1015.             self.mainui.bg.allachiv.achivlisttiledone[i]:Hide()
  1016.         end
  1017.        
  1018.        
  1019.         local __name = "Название: "
  1020.         local __desc = "Описание: "
  1021.        
  1022.         if not STRINGS.ACHIEVEMENT_LIST[self.listitem[i].name] then
  1023.             print("error:========",self.listitem[i].name)
  1024.         else
  1025.             __name = STRINGS.ACHIEVEMENT_LIST[self.listitem[i].name].name
  1026.             __desc = string.format(STRINGS.ACHIEVEMENT_LIST[self.listitem[i].name].desc,achievement_config.idconfig[self.listitem[i].name].need_amount)
  1027.         end
  1028.        
  1029.         if achievement_config.idconfig[self.listitem[i].name] ~= nil and self.listitem[i].name ~= "all" then
  1030.             self.mainui.bg.allachiv.achivlisttile[i]:SetHoverText(__name.."\n"..STRINGS.ACHIEVEMENT_ACHIEVEMENT_FINISHED..self.listitem[i].current.."/"..achievement_config.idconfig[self.listitem[i].name].need_amount.."\n"..__desc)
  1031.             self.mainui.bg.allachiv.achivlisttiledone[i]:SetHoverText(STRINGS.ACHIEVEMENT_ACHIEVEMENT_FINISHED..self.listitem[i].current.."/"..achievement_config.idconfig[self.listitem[i].name].need_amount)
  1032.         else
  1033.             self.mainui.bg.allachiv.achivlisttile[i]:SetHoverText(__name.."\n"..STRINGS.ACHIEVEMENT_ACHIEVEMENT_FINISHED..self.listitem[i].check.."/1".."\n"..__desc)
  1034.             self.mainui.bg.allachiv.achivlisttiledone[i]:SetHoverText(STRINGS.ACHIEVEMENT_ACHIEVEMENT_FINISHED..self.listitem[i].check.."/1")
  1035.         end
  1036.        
  1037.         if self.listitem[i].name == "all" then
  1038.             self.mainui.bg.allachiv.achivlisttile[i]:SetHoverText(STRINGS.ACHIEVEMENT_ACHIEVEMENT_FINISHED..self.achivlist[#self.achivlist].current.."/"..(#self.achivlist-1))
  1039.             self.mainui.bg.allachiv.achivlisttiledone[i]:SetHoverText(STRINGS.ACHIEVEMENT_ACHIEVEMENT_FINISHED..self.achivlist[#self.achivlist].current.."/"..(#self.achivlist-1))
  1040.         end
  1041.     end
  1042. end
  1043.  
  1044. function uiachievement:build()
  1045.     self.mainui.bg.allachiv:KillAllChildren()
  1046.     self.listitem = {}
  1047.     for a = 1, #self.achivlist do
  1048.         if self.item == 1 then
  1049.             table.insert(self.listitem, self.achivlist[a])
  1050.         else
  1051.             if self.achivlist[a].item == self.item  then
  1052.                 table.insert(self.listitem, self.achivlist[a])
  1053.             end
  1054.         end
  1055.     end
  1056.  
  1057.     local x = -313
  1058.     local y = 360
  1059.     for i = 1+14*(self.numpage-1), math.min(#self.listitem, 14*(1+self.numpage-1)) do
  1060.         if math.ceil(i/2) ~= i/2 then x = -265 else x = 265 end
  1061.         if math.ceil(i/2) ~= i/2 then y = y-97.3 end
  1062.  
  1063.         local check = "dact"
  1064.         if self.listitem[i].check == 1 then check = "act" end
  1065.  
  1066.         self.mainui.bg.allachiv.achivlisttile[i] = self.mainui.bg.allachiv:AddChild(ImageButton("images/hud/achivbg_"..check..".xml", "achivbg_"..check..".tex"))
  1067.         self.mainui.bg.allachiv.achivlisttile[i]:SetFocusScale(1,1,1)
  1068.         self.mainui.bg.allachiv.achivlisttile[i]:SetPosition(x, y, 0)
  1069.         local achievement_name = self.listitem[i].name
  1070.         local achievement_desc = self.listitem[i].name
  1071.         if not STRINGS.ACHIEVEMENT_LIST[self.listitem[i].name] then
  1072.             print("error:========",self.listitem[i].name)
  1073.         else
  1074.             achievement_name = STRINGS.ACHIEVEMENT_LIST[self.listitem[i].name].name
  1075.             achievement_desc = STRINGS.ACHIEVEMENT_LIST[self.listitem[i].name].desc
  1076.         end
  1077.         self.mainui.bg.allachiv.achivlisttile[i].name = self.mainui.bg.allachiv.achivlisttile[i]:AddChild(Text(NEWFONT_OUTLINE, 40, achievement_name))
  1078.         self.mainui.bg.allachiv.achivlisttile[i].name:SetPosition(15, 25, 0)
  1079.         self.mainui.bg.allachiv.achivlisttile[i].name:SetHAlign(ANCHOR_LEFT)
  1080.         self.mainui.bg.allachiv.achivlisttile[i].name:SetRegionSize(320,40)
  1081.  
  1082.         self.mainui.bg.allachiv.achivlisttile[i].desc = self.mainui.bg.allachiv.achivlisttile[i]:AddChild(Text(NEWFONT, 28, string.format(achievement_desc,achievement_config.idconfig[self.listitem[i].name].need_amount)))
  1083.         self.mainui.bg.allachiv.achivlisttile[i].desc:SetPosition(15, -23, 0)
  1084.         self.mainui.bg.allachiv.achivlisttile[i].desc:SetHAlign(ANCHOR_LEFT)
  1085.         self.mainui.bg.allachiv.achivlisttile[i].desc:SetRegionSize(320,40)
  1086.          
  1087.         self.mainui.bg.allachiv.achivlisttile[i].nums = self.mainui.bg.allachiv.achivlisttile[i]:AddChild(Text(NEWFONT, 28, "x "..achievement_config.idconfig[self.listitem[i].name].point))
  1088.         self.mainui.bg.allachiv.achivlisttile[i].nums:SetPosition(320, -23, 0)
  1089.         self.mainui.bg.allachiv.achivlisttile[i].nums:SetHAlign(ANCHOR_LEFT)
  1090.         self.mainui.bg.allachiv.achivlisttile[i].nums:SetRegionSize(320,40)
  1091.  
  1092.         self.mainui.bg.allachiv.achivlisttile[i].numb = self.mainui.bg.allachiv.achivlisttile[i]:AddChild(Text(NEWFONT, 28, "No:"..i))
  1093.         self.mainui.bg.allachiv.achivlisttile[i].numb:SetPosition(320, 33, 0)
  1094.         self.mainui.bg.allachiv.achivlisttile[i].numb:SetHAlign(ANCHOR_LEFT)
  1095.         self.mainui.bg.allachiv.achivlisttile[i].numb:SetRegionSize(320,40)
  1096.         self.mainui.bg.allachiv.achivlisttile[i].numb:SetColour(0/255, 166/255, 51/255, 1) --(41/255, 174/255, 10/255, 1)
  1097.         self.mainui.bg.allachiv.achivlisttile[i]:SetOnClick(function()
  1098.             if TheInput:IsKeyDown(KEY_ALT) and TheInput:IsKeyDown(KEY_SHIFT) then
  1099.                 if self.cooldown then
  1100.                     if achievement_config.idconfig[self.listitem[i].name] ~= nil  and self.listitem[i].name ~= "all" then
  1101.                         TheNet:Say(string.format(STRINGS.SINGLE_ACHIVEMENT_PROCESS,achievement_name,self.listitem[i].current,achievement_config.idconfig[self.listitem[i].name].need_amount))
  1102.                     end
  1103.                     if self.listitem[i].name == "all" then
  1104.                         TheNet:Say(string.format(STRINGS.SINGLE_ACHIVEMENT_PROCESS,achievement_name,self.achivlist[#self.achivlist].current,(#self.achivlist-1)))
  1105.                     end
  1106.  
  1107.                     self.cooldown = false
  1108.                     self.owner:DoTaskInTime(3, function() self.cooldown = true end)
  1109.                 end
  1110.             else
  1111.                 if killAmountFinishAchievement == true and achievement_config.idconfig[self.listitem[i].name] ~= nil and self.listitem[i].name ~= "all" and self.listitem[i].check ~= 1  then
  1112.                     SendModRPCToServer(MOD_RPC["DSTAchievement"]["finishachievement"],self.listitem[i].name)
  1113.                 end
  1114.             end
  1115.         end)
  1116.         if self.listitem[i].name == "all" then
  1117.             self.mainui.bg.allachiv.achivlisttile[i].numb:Hide()
  1118.         end
  1119.  
  1120.         if self.listitem[i].check == 1 then
  1121.             self.mainui.bg.allachiv.achivlisttile[i].desc:SetColour(217/255, 170/255, 83/255, 1)  --(124/255, 64/255, 8/255, 1)
  1122.             self.mainui.bg.allachiv.achivlisttile[i].nums:SetColour(217/255, 170/255, 83/255, 1)  --(124/255, 64/255, 8/255, 1)
  1123.         else
  1124.             self.mainui.bg.allachiv.achivlisttile[i].desc:SetColour(0, 0, 0, 1)  --(39/255, 39/255, 39/255, 1)
  1125.             self.mainui.bg.allachiv.achivlisttile[i].nums:SetColour(39/255, 39/255, 39/255, 1)  --(39/255, 39/255, 39/255, 1)
  1126.         end
  1127.        
  1128.         self.mainui.bg.allachiv.achivlisttiledone[i] = self.mainui.bg.allachiv:AddChild(Image("images/hud/achivbg_done.xml", "achivbg_done.tex"))
  1129.         self.mainui.bg.allachiv.achivlisttiledone[i]:SetPosition(x, y, 0)
  1130.         self.mainui.bg.allachiv.achivlisttiledone[i]:SetTint(1,1,1,0.95)
  1131.    
  1132.         if self.mainui.bg.allachiv.achivlisttiledone[i].check == 1 then
  1133.             self.mainui.bg.allachiv.achivlisttiledone[i]:Show()
  1134.         else
  1135.             self.mainui.bg.allachiv.achivlisttiledone[i]:Hide()
  1136.         end
  1137.     end
  1138. end
  1139.  
  1140. function uiachievement:coinbuild()
  1141.     self.mainui.bg.allcoin:KillAllChildren()
  1142.     local x = -313
  1143.     local y = 260
  1144.     for i = 1+28*(self.numpage2-1), math.min(#self.coinlist, 28*(1+self.numpage2-1)) do
  1145.         if math.ceil(i/4) ~= math.ceil((i-1)/4) then x = -360 else x = x + 360*2/3 end
  1146.         y = 260-96*(math.ceil((i-28*(self.numpage2-1))/4)-1)
  1147.         self.coinlistbutton[i] = self.mainui.bg.allcoin:AddChild(ImageButton("images/coin_cn/coin_cn1.xml", "coin_cn1.tex"))
  1148.         if  self.coinlist[i].name == "speedup" or self.coinlist[i].name == "absorbup" or
  1149.             self.coinlist[i].name == "damageup" or self.coinlist[i].name == "crit"  then
  1150.             self.coinlistbutton[i]:SetTextures("images/coin_cn/coin_cn0.xml", "coin_cn0.tex")
  1151.         end
  1152.         self.coinlistbutton[i]:SetPosition(x, y, 0)
  1153.         self.coinlistbutton[i]:SetOnClick(function()
  1154.            
  1155.             if TheInput:IsKeyDown(KEY_ALT) and TheInput:IsKeyDown(KEY_SHIFT) then
  1156.                 if self.cooldown then
  1157.                     if i>=1 and i <=3 then
  1158.                         TheNet:Say( string.format(STRINGS.HAS_ABILITY_PROCESS,STRINGS.ACHIVABILITYNAME[self.coinlist[i].name],self.coinlist[i].current,5))
  1159.                     elseif i==4 then
  1160.                         TheNet:Say( string.format(STRINGS.HAS_ABILITY_PROCESS,STRINGS.ACHIVABILITYNAME[self.coinlist[i].name],self.coinlist[i].current,20))
  1161.                     else
  1162.                         if self.coinlist[i].current ~= nil and  self.coinlist[i].current >=  1 then
  1163.                             TheNet:Say(string.format(STRINGS.HAS_ABILITY,STRINGS.ACHIVABILITYNAME[self.coinlist[i].name]))
  1164.                         else
  1165.                             TheNet:Say(string.format(STRINGS.NO_ABILITY,STRINGS.ACHIVABILITYNAME[self.coinlist[i].name]))
  1166.                         end
  1167.                     end
  1168.                     self.cooldown = false
  1169.                     self.owner:DoTaskInTime(3, function() self.cooldown = true end)
  1170.                 end
  1171.                 return
  1172.             end
  1173.             SendModRPCToServer(MOD_RPC["DSTAchievement"][self.coinlist[i].name])
  1174.             self.owner:DoTaskInTime(.3, function()
  1175.                 self:loadcoinlist()
  1176.                 if i>=1 and i <=3 then
  1177.                     self.coinlistbutton[i]:SetHoverText(string.format(STRINGS.ACHIEVEMENT_HAS_AWARD,self.coinlist[i].current,5))
  1178.                 elseif i==4 then
  1179.                     self.coinlistbutton[i]:SetHoverText(string.format(STRINGS.ACHIEVEMENT_HAS_AWARD,self.coinlist[i].current,20))
  1180.                 else
  1181.                     local __name = STRINGS.ACHIVABILITYNAME[self.coinlist[i].name]
  1182.                     local __desc = STRINGS.ACHIVABILITYDSPC[self.coinlist[i].name]
  1183.                     if  self.coinlist[i].current ~= nil and  self.coinlist[i].current >=  1 then
  1184.                         self.coinlistbutton[i]:SetHoverText(__desc.."\n\n"..STRINGS.ACHIEVEMENT_HAS_ABILITY)
  1185.                         self.coinlistbutton[i].done:Show()
  1186.                     else
  1187.                         self.coinlistbutton[i]:SetHoverText(__name.."\n"..__desc.."\n\n"..string.format(STRINGS.ACHIEVEMENT_ABILITY_NEED, id2ability[self.coinlist[i].name].cost))
  1188.                         self.coinlistbutton[i].done:Hide()
  1189.                     end
  1190.                 end
  1191.             end)
  1192.         end)
  1193.         -- Установка имени награды
  1194.         self.coinlistbutton[i].name = self.coinlistbutton[i]:AddChild(Text(NEWFONT, 40, STRINGS.ACHIVABILITYNAME[self.coinlist[i].name]))
  1195.         self.coinlistbutton[i].name:SetPosition(8, 10, 0)
  1196.         self.coinlistbutton[i].name:SetHAlign(ANCHOR_LEFT)
  1197.         self.coinlistbutton[i].name:SetRegionSize(200,60)
  1198.         self.coinlistbutton[i].name:SetColour(1,1,1,1)
  1199.         -- Установка описания награды
  1200.         self.coinlistbutton[i].desc = self.coinlistbutton[i]:AddChild(Text(NEWFONT, 26, STRINGS.ACHIVABILITYDSPC[self.coinlist[i].name]))
  1201.         self.coinlistbutton[i].desc:SetPosition(8, -20, 0)
  1202.         self.coinlistbutton[i].desc:SetHAlign(ANCHOR_LEFT)
  1203.         self.coinlistbutton[i].desc:SetRegionSize(200,60)
  1204.         self.coinlistbutton[i].desc:SetColour(255/255,255/255,0/255,1)
  1205.         -- Установка цены награды
  1206.         self.coinlistbutton[i].nums = self.coinlistbutton[i]:AddChild(Text(NEWFONT, 35,("-"..id2ability[self.coinlist[i].name].cost)))
  1207.         self.coinlistbutton[i].nums:SetPosition(50, 8, 0)
  1208.         self.coinlistbutton[i].nums:SetHAlign(ANCHOR_RIGHT)
  1209.         self.coinlistbutton[i].nums:SetRegionSize(80,30)
  1210.         self.coinlistbutton[i].nums:SetColour(253/255, 253/255, 35/255, 1)--(237/255, 235/255, 16/255, 1)
  1211.  
  1212.         self.coinlistbutton[i].imge = self.coinlistbutton[i]:AddChild(Image("images/coin_cn/coin_cn_start.xml", "coin_cn_start.tex"))
  1213.         self.coinlistbutton[i].imge:SetPosition(5, -5, 0)
  1214.         self.coinlistbutton[i].imge:SetTint(1,1,1,0.95)
  1215.  
  1216.         self.coinlistbutton[i].chge = self.coinlistbutton[i]:AddChild(Image("images/coin_cn/coin_cn_change.xml", "coin_cn_change.tex"))
  1217.         self.coinlistbutton[i].chge:SetPosition(0, 0, 0)
  1218.         self.coinlistbutton[i].chge:SetTint(1,1,1,0.95)
  1219.  
  1220.         if self.coinlist[i].canswitch then
  1221.             self.coinlistbutton[i].chge:Show()
  1222.         else
  1223.             self.coinlistbutton[i].chge:Hide()
  1224.         end
  1225.  
  1226.         self.coinlistbutton[i].done = self.coinlistbutton[i]:AddChild(Image("images/coin_cn/coin_cn3.xml", "coin_cn3.tex"))
  1227.         self.coinlistbutton[i].done:SetPosition(0, 0, 0)
  1228.         self.coinlistbutton[i].done:SetTint(1,1,1,0.95)
  1229.  
  1230.         --line
  1231.         self.coinlistbutton[i].line = self.coinlistbutton[i]:AddChild(Image("images/coin_cn/coin_cn_line.xml", "coin_cn_line.tex"))
  1232.         self.coinlistbutton[i].line:SetPosition(0, 0, 0)
  1233.         self.coinlistbutton[i].line:SetTint(1,1,1,0.95)
  1234.         self.coinlistbutton[i].line:Hide()
  1235.  
  1236.         if self.coinlist[i].name == "speedup" or self.coinlist[i].name == "absorbup" or
  1237.             self.coinlist[i].name == "damageup" or self.coinlist[i].name == "crit"  then
  1238.             self.coinlistbutton[i].done:Hide()
  1239.         else
  1240.             if  self.coinlist[i].current ~= nil and  self.coinlist[i].current >=  1 then
  1241.                 self.coinlistbutton[i].done:Show()
  1242.             else
  1243.                 self.coinlistbutton[i].done:Hide()
  1244.             end
  1245.         end
  1246.  
  1247.         self.coinlistbutton[i]:SetNormalScale(1,1,1)
  1248.         self.coinlistbutton[i]:SetFocusScale(1,1,1)
  1249.  
  1250.         self.coinlistbutton[i]:SetOnGainFocus(function()
  1251.             self.coinlistbutton[i]:SetNormalScale(1,1,1)
  1252.             self.coinlistbutton[i].line:Show()
  1253.  
  1254.         end)
  1255.         self.coinlistbutton[i]:SetOnLoseFocus(function()
  1256.             self.coinlistbutton[i]:SetFocusScale(1,1,1)
  1257.             self.coinlistbutton[i].line:Hide()
  1258.         end)
  1259.         if i>=1 and i <=3 then
  1260.             self.coinlistbutton[i]:SetHoverText(string.format(STRINGS.ACHIEVEMENT_HAS_AWARD,self.coinlist[i].current,5))
  1261.         elseif i==4 then
  1262.             self.coinlistbutton[i]:SetHoverText(string.format(STRINGS.ACHIEVEMENT_HAS_AWARD,self.coinlist[i].current,20))
  1263.         else
  1264.             local __name = STRINGS.ACHIVABILITYNAME[self.coinlist[i].name]
  1265.             local __desc = STRINGS.ACHIVABILITYDSPC[self.coinlist[i].name]
  1266.             if  self.coinlist[i].current ~= nil and  self.coinlist[i].current ==  1 then
  1267.                 self.coinlistbutton[i]:SetHoverText(__desc.."\n\n"..STRINGS.ACHIEVEMENT_HAS_ABILITY)
  1268.             else
  1269.                 self.coinlistbutton[i]:SetHoverText(__name.."\n"..__desc.."\n\n"..string.format(STRINGS.ACHIEVEMENT_ABILITY_NEED, id2ability[self.coinlist[i].name].cost))
  1270.             end
  1271.         end
  1272.     end
  1273. end
  1274.  
  1275. function uiachievement:loadlist()
  1276.     self.achivlist = {}
  1277.     for _,v in ipairs(achievement_config.config) do
  1278.         if v.catagory then
  1279.             table.insert(self.achivlist,#self.achivlist + 1,
  1280.             {
  1281.                 name = v.id,
  1282.                 check = self.owner[v.check]:value(),
  1283.                 current = self.owner[v.current]:value(),
  1284.                 item = v.catagory,
  1285.             })
  1286.         end
  1287.     end
  1288.     local achivvalue = 0
  1289.     for i=1, #self.achivlist do
  1290.         if self.achivlist[i].name ~= "all" then
  1291.             achivvalue = achivvalue + self.achivlist[i].check
  1292.         else
  1293.             self.achivlist[i].current = achivvalue
  1294.         end
  1295.     end
  1296. end
  1297.  
  1298. function uiachievement:loadcoinlist()
  1299.     self.coinlist = {}
  1300.     for _,v in ipairs(achievement_ability_config.ability_cost) do
  1301.         self.coinlist[#self.coinlist + 1] =
  1302.         {
  1303.             name = v.ability,
  1304.             current = self.owner["current" .. v.ability]:value(),
  1305.             canswitch = v.canswitch,
  1306.         }
  1307.     end
  1308. end
  1309.  
  1310. return uiachievement
  1311.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement