select_area.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { _decorator, Component, instantiate, Node, Prefab, Sprite, SpriteFrame } from 'cc';
  2. import { base_ui } from '../../fw/base_ui';
  3. import { select_area_item } from './select_area_item';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('select_area')
  6. export class select_area extends base_ui {
  7. @property(Node) btn_close:Node = null
  8. @property(Node) img_title:Node = null
  9. @property(SpriteFrame) sf_province:SpriteFrame = null
  10. @property(SpriteFrame) sf_city:SpriteFrame = null
  11. @property(Node) province_btn_node:Node = null
  12. @property(Node) province_btn_next:Node = null
  13. @property(Node) city_btn_node:Node = null
  14. @property(Node) city_btn_up:Node = null
  15. @property(Node) city_btn_true:Node = null
  16. @property(Node) list_content:Node = null
  17. @property(Prefab) list_item:Prefab = null
  18. protected start(): void {
  19. this.onButtonListen(this.btn_close, ()=>{
  20. this.close()
  21. })
  22. this.onButtonListen(this.province_btn_next, ()=>{
  23. this.onClickProviceNext()
  24. })
  25. this.onButtonListen(this.city_btn_up, ()=>{
  26. this.onClickCityUp()
  27. })
  28. this.onButtonListen(this.city_btn_true, ()=>{
  29. this.onClickCityTrue()
  30. })
  31. this.reloadProvinceListData()
  32. }
  33. private onClickProviceNext() {
  34. this.img_title.getComponent(Sprite).spriteFrame = this.sf_city
  35. this.province_btn_node.active = false
  36. this.city_btn_node.active = true
  37. }
  38. private onClickCityUp() {
  39. this.img_title.getComponent(Sprite).spriteFrame = this.sf_province
  40. this.province_btn_node.active = true
  41. this.city_btn_node.active = false
  42. }
  43. private onClickCityTrue() {
  44. this.close()
  45. }
  46. private reloadProvinceListData() {
  47. this.list_content.removeAllChildren()
  48. for (let index = 0; index < 50; index++) {
  49. let item = instantiate(this.list_item)
  50. item.parent = this.list_content;
  51. item.getComponent(select_area_item).initView(()=>{
  52. })
  53. }
  54. }
  55. private reloadCityListData() {
  56. }
  57. }