|
@@ -50,9 +50,24 @@ export class widget_item extends Component {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- public initWidgetAddCurEditSecne() {
|
|
|
- this.lab_name.setPosition(this.lab_name.getPosition().x,-117,0)
|
|
|
- this.lab_name.getComponent(Label).string = this.m_data.name + (this.m_data.att?`id:${this.m_data.att.id}`:"");
|
|
|
+ public showPageNumberName() {
|
|
|
+ // console.log('showPageNumberName lab_name=',this.lab_name.getComponent(Label).string)
|
|
|
+ if(this.m_data.scene_type>0) {
|
|
|
+ if(this.m_data.is_container_layer) {
|
|
|
+ let name = `第${this.m_data.scene_page_number}页-容器层-${this.lab_name.getComponent(Label).string}`
|
|
|
+ this.lab_name.getComponent(Label).string = name
|
|
|
+ } else {
|
|
|
+ let name = `第${this.m_data.scene_page_number}页-${this.lab_name.getComponent(Label).string}`
|
|
|
+ this.lab_name.getComponent(Label).string = name
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public initWidgetAddCurEditSecne(timeout:number=0) {
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.updateLabNamePosition()
|
|
|
+ this.lab_name.getComponent(Label).string = this.m_data.name + (this.m_data.att?`id:${this.m_data.att.id}`:"");
|
|
|
+ },timeout)
|
|
|
}
|
|
|
|
|
|
public initWidgetType() {
|
|
@@ -62,7 +77,7 @@ export class widget_item extends Component {
|
|
|
public hideContainerChilden(){
|
|
|
this.m_isShowContainerChilden = false
|
|
|
}
|
|
|
- public initHideDragOtherList() {
|
|
|
+ public hideDragOtherList() {
|
|
|
// 点击->控件列表,不显示拖拽其他按钮
|
|
|
this.hideContainerChilden()
|
|
|
this.m_isShowDragOtherList = true
|
|
@@ -219,7 +234,7 @@ export class widget_item extends Component {
|
|
|
if(container_layer!=null){
|
|
|
for (let index = 0; index < container_layer.widget_list.length; index++) {
|
|
|
const widget_data = container_layer.widget_list[index];
|
|
|
- console.log("widget_data",widget_data)
|
|
|
+ // console.log("widget_data",widget_data)
|
|
|
let node = instantiate(this.self_pf)
|
|
|
node.getComponent(widget_item).initWidgetByScene(widget_data,widget_data.att)
|
|
|
node.parent = this.container
|
|
@@ -246,49 +261,55 @@ export class widget_item extends Component {
|
|
|
this.m_att.id = config.getNewId();
|
|
|
}
|
|
|
|
|
|
- if(this.m_data.type===config.Widget_Type_List.DRAG_TYPE){
|
|
|
- if(this.m_att.drag_data===null){
|
|
|
- this.m_att.drag_data = new att_drag_data;
|
|
|
- }
|
|
|
- this.drag.active = true;
|
|
|
- if(this.m_isShowDragOtherList == false) {
|
|
|
- this.initDrag()
|
|
|
+ if(this.m_data.type===config.Widget_Type_List.CLICK_TYPE){
|
|
|
+ if(this.m_att.click_data===null){
|
|
|
+ this.m_att.click_data = new att_click_data;
|
|
|
}
|
|
|
+ this.lab_name.getComponent(Label).string = config.clcik_type_map.get(this.m_att.click_data.click_type) +`id:${this.m_att.id}`
|
|
|
}else if(this.m_data.type===config.Widget_Type_List.SLIDE_TYPE){
|
|
|
this.slide.active = true;
|
|
|
if(this.m_att.slide_data===null){
|
|
|
this.m_att.slide_data = new att_slide_data;
|
|
|
}
|
|
|
this.initSlide()
|
|
|
- }else if(this.m_data.type===config.Widget_Type_List.CLICK_TYPE){
|
|
|
- if(this.m_att.click_data===null){
|
|
|
- this.m_att.click_data = new att_click_data;
|
|
|
+ this.lab_name.getComponent(Label).string = `滑动id:${this.m_att.id}`
|
|
|
+ }else if(this.m_data.type===config.Widget_Type_List.DRAG_TYPE){
|
|
|
+ if(this.m_att.drag_data===null){
|
|
|
+ this.m_att.drag_data = new att_drag_data;
|
|
|
}
|
|
|
- this.lab_name.getComponent(Label).string = config.clcik_type_map.get(this.m_att.click_data.click_type) +`id${this.m_att.id}`
|
|
|
+ this.drag.active = true;
|
|
|
+ if(this.m_isShowDragOtherList == false) {
|
|
|
+ this.initDrag()
|
|
|
+ }
|
|
|
+ this.lab_name.getComponent(Label).string = `拖拽id:${this.m_att.id}`
|
|
|
}else if(this.m_data.type===config.Widget_Type_List.UI_TOP){
|
|
|
if(this.m_att.top_data===null){
|
|
|
this.m_att.top_data = new att_top_data;
|
|
|
}
|
|
|
this.initUiWidget()
|
|
|
- this.lab_name.getComponent(Label).string = `弹窗:${config.top_view_type_map.get(this.m_att.top_data.top_ui_type)}:id${this.m_att.id}`
|
|
|
+ this.lab_name.getComponent(Label).string = `弹窗:${config.top_view_type_map.get(this.m_att.top_data.top_ui_type)}:id:${this.m_att.id}`
|
|
|
+ }else if(this.m_data.type==config.Widget_Type_List.IMG_TYPE) {
|
|
|
+ this.lab_name.getComponent(Label).string = `图片id:${this.m_att.id}`
|
|
|
+ }else if(this.m_data.type==config.Widget_Type_List.ACTION_TYPE) {
|
|
|
+ this.lab_name.getComponent(Label).string = `动画id:${this.m_att.id}`
|
|
|
}else if(this.m_data.type===config.Widget_Type_List.TEXT_SOUND){
|
|
|
if(this.m_att.text_sound_data===null){
|
|
|
this.m_att.text_sound_data = new att_text_sound_data;
|
|
|
}
|
|
|
- this.lab_name.getComponent(Label).string =`文本和语音-id:${this.m_att.id}`
|
|
|
+ this.lab_name.getComponent(Label).string =`文本和语音id:${this.m_att.id}`
|
|
|
this.initTextSound()
|
|
|
}else if(this.m_data.type===config.Widget_Type_List.QUESTION_SELECT){
|
|
|
if(this.m_att.question_select===null){
|
|
|
this.m_att.question_select = new att_question_select;
|
|
|
}
|
|
|
this.initQuestionSelect()
|
|
|
- this.lab_name.getComponent(Label).string =`问题选择-id:${this.m_att.id}`
|
|
|
+ this.lab_name.getComponent(Label).string =`问题选择id:${this.m_att.id}`
|
|
|
}else if(this.m_data.type===config.Widget_Type_List.COUNT_DOWN){
|
|
|
if(this.m_att.count_down===null){
|
|
|
this.m_att.count_down = new att_count_down;
|
|
|
}
|
|
|
this.initCountDown()
|
|
|
- this.lab_name.getComponent(Label).string =`倒计时-id:${this.m_att.id}`
|
|
|
+ this.lab_name.getComponent(Label).string =`倒计时id:${this.m_att.id}`
|
|
|
}else if(this.m_data.type===config.Widget_Type_List.CONTAINER_LAYER){
|
|
|
if(this.m_att.container_layer===null){
|
|
|
this.m_att.container_layer = new att_container;
|
|
@@ -296,7 +317,7 @@ export class widget_item extends Component {
|
|
|
if(this.m_isShowContainerChilden){
|
|
|
this.initConatiner()
|
|
|
}
|
|
|
- this.lab_name.getComponent(Label).string =`容器层-id:${this.m_att.id}`
|
|
|
+ this.lab_name.getComponent(Label).string =`容器层id:${this.m_att.id}`
|
|
|
}
|
|
|
this.node.active = this.m_att.edit_active
|
|
|
}
|
|
@@ -327,6 +348,13 @@ export class widget_item extends Component {
|
|
|
})
|
|
|
}
|
|
|
else if(this.m_data.type==config.Widget_Type_List.CONTAINER_LAYER){
|
|
|
+ // MAC电脑浏览器
|
|
|
+ if(config.is_MAC_edit) {
|
|
|
+ this.node.on(Node.EventType.TOUCH_END,(et:EventTouch)=>{
|
|
|
+ ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
+ },this,true)
|
|
|
+ return
|
|
|
+ }
|
|
|
this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
|
|
|
ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
},this,true)
|
|
@@ -345,30 +373,24 @@ export class widget_item extends Component {
|
|
|
ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
}
|
|
|
})
|
|
|
- this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
|
|
|
- et.propagationStopped = true;
|
|
|
- let pos = this.node.parent.getComponent(UITransform).convertToWorldSpaceAR(this.node.position)
|
|
|
- if(this.x_len==0){
|
|
|
- this.x_len = (et.getUILocation().x - pos.x)*2;
|
|
|
- this.y_len = (et.getUILocation().y - pos.y)*2;
|
|
|
- let p = new Vec3(et.getUILocation().x,et.getUILocation().y)
|
|
|
- let n_p = this.node.parent.getComponent(UITransform).convertToNodeSpaceAR(p)
|
|
|
- this.node.position = new Vec3(n_p.x-this.x_len,n_p.y-this.y_len);
|
|
|
- // console.log("a_x",this.x_len, this.y_len ,et.getUILocation().x,this.m_att.width)
|
|
|
- }
|
|
|
- // console.log("this.x_len",this.x_len,this.y_len)
|
|
|
- this.isMove = true;
|
|
|
- ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
- })
|
|
|
-
|
|
|
- this.node.on(Node.EventType.MOUSE_LEAVE,()=>{
|
|
|
- if(this.node.parent.name=="content"){
|
|
|
- this.node.parent.parent.parent.getComponent(scroll_scene).startTouch()
|
|
|
- }
|
|
|
- this.isMove = false;
|
|
|
- this.x_len = 0;
|
|
|
- this.y_len = 0;
|
|
|
- })
|
|
|
+
|
|
|
+ if(!config.is_MAC_edit) {
|
|
|
+ this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
|
|
|
+ et.propagationStopped = true;
|
|
|
+ let pos = this.node.parent.getComponent(UITransform).convertToWorldSpaceAR(this.node.position)
|
|
|
+ if(this.x_len==0){
|
|
|
+ this.x_len = (et.getUILocation().x - pos.x)*2;
|
|
|
+ this.y_len = (et.getUILocation().y - pos.y)*2;
|
|
|
+ let p = new Vec3(et.getUILocation().x,et.getUILocation().y)
|
|
|
+ let n_p = this.node.parent.getComponent(UITransform).convertToNodeSpaceAR(p)
|
|
|
+ this.node.position = new Vec3(n_p.x-this.x_len,n_p.y-this.y_len);
|
|
|
+ // console.log("a_x",this.x_len, this.y_len ,et.getUILocation().x,this.m_att.width)
|
|
|
+ }
|
|
|
+ // console.log("this.x_len",this.x_len,this.y_len)
|
|
|
+ this.isMove = true;
|
|
|
+ ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
+ })
|
|
|
+ }
|
|
|
this.node.on(Node.EventType.TOUCH_END,(et:EventTouch)=>{
|
|
|
if(this.node.parent.name=="content"){
|
|
|
this.node.parent.parent.parent.getComponent(scroll_scene).startTouch()
|
|
@@ -393,7 +415,15 @@ export class widget_item extends Component {
|
|
|
ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
+ this.node.on(Node.EventType.MOUSE_LEAVE,()=>{
|
|
|
+ if(this.node.parent.name=="content"){
|
|
|
+ this.node.parent.parent.parent.getComponent(scroll_scene).startTouch()
|
|
|
+ }
|
|
|
+ this.isMove = false;
|
|
|
+ this.x_len = 0;
|
|
|
+ this.y_len = 0;
|
|
|
+ })
|
|
|
}
|
|
|
ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
ClientEvent.on(config.Event.UpdateAttributesToView,this.UpdateAttributesToView,this)
|
|
@@ -408,7 +438,7 @@ export class widget_item extends Component {
|
|
|
return;
|
|
|
}
|
|
|
if(data.id===this.m_att.id){
|
|
|
- console.log("this.m_att",this.m_att)
|
|
|
+ // console.log("this.m_att",this.m_att)
|
|
|
switch(update_type){
|
|
|
case config.attributes_list_type.pos:
|
|
|
this.m_att.x = data.x;
|
|
@@ -425,6 +455,7 @@ export class widget_item extends Component {
|
|
|
this.m_att.height = data.height;
|
|
|
this.spr.getComponent(UITransform).contentSize = new Size(data.width,data.height)
|
|
|
this.node.getComponent(UITransform).contentSize = this.spr.getComponent(UITransform).contentSize
|
|
|
+ this.updateLabNamePosition()
|
|
|
break;
|
|
|
case config.attributes_list_type.anchor:
|
|
|
this.m_att.anchor_x = data.anchor_x;
|
|
@@ -450,6 +481,7 @@ export class widget_item extends Component {
|
|
|
spFrame2.texture = texture;
|
|
|
this.spr.getComponent(Sprite).spriteFrame = spFrame2
|
|
|
this.spr.getComponent(UITransform).contentSize = new Size(data.width,data.height)
|
|
|
+ this.updateLabNamePosition()
|
|
|
director.once(Director.EVENT_AFTER_DRAW,()=>{
|
|
|
this.node.getComponent(UITransform).contentSize = this.spr.getComponent(UITransform).contentSize
|
|
|
})
|
|
@@ -462,6 +494,7 @@ export class widget_item extends Component {
|
|
|
if(this.m_att.src.length>0){
|
|
|
this.spr.getComponent(UITransform).setContentSize(new Size(this.m_att.width,this.m_att.height))
|
|
|
this.node.getComponent(UITransform).contentSize = this.spr.getComponent(UITransform).contentSize
|
|
|
+ this.updateLabNamePosition()
|
|
|
ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
|
|
|
|
|
|
// this.spr.getComponent(Sprite).sizeMode = Sprite.SizeMode.RAW;
|
|
@@ -587,6 +620,11 @@ export class widget_item extends Component {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ updateLabNamePosition() {
|
|
|
+ let lab_name_y = -(this.spr.getComponent(UITransform).contentSize.height/2+17) //-117
|
|
|
+ this.lab_name.setPosition(this.lab_name.getPosition().x,lab_name_y,0)
|
|
|
+ }
|
|
|
+
|
|
|
updateDir(){
|
|
|
if(this.call_back==null){
|
|
|
switch (this.m_att.img_dir) {
|