当前位置: 首页 > news >正文

班级网站设计模板天猫seo搜索优化

班级网站设计模板,天猫seo搜索优化,网站建设具体步骤应该怎么做,如何快速制作一个网站遇到情况 : 场景a -》层1-》层2 1、层一点击没有传递到场景a ( 这个考虑到可能是场景调用的层 内部代码屏幕场景中的点击 如果层调用层就出现2情况了 ) 2、但 层2点击会点击到层1 处理方式: 为层创建全局触摸调用函数 to…
 遇到情况 :
场景a -》层1-》层2
1、层一点击没有传递到场景a   ( 这个考虑到可能是场景调用的层 内部代码屏幕场景中的点击  如果层调用层就出现2情况了
2、但    层2点击会点击到层1
处理方式:
为层创建全局触摸调用函数  touchbegan 返回true 吞噬事件 继续调用touchmove等
.h
bool onTouchBegan(Touch* touch, Event* event) ;
void onTouchMoved(Touch* touch, Event* event);
void onTouchEnded(Touch* touch, Event* event) ;

 

.cpp
EventListenerTouchOneByOne*touchListener = EventListenerTouchOneByOne::create();//给scrollview所有sprite添加监听用
touchListener->onTouchBegan = CC_CALLBACK_2(WjjnLayer::onTouchBegan, this);
touchListener->onTouchMoved = CC_CALLBACK_2(WjjnLayer::onTouchMoved, this);
touchListener->onTouchEnded = CC_CALLBACK_2(WjjnLayer::onTouchEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
touchListener->setSwallowTouches(true);

bool WjjnLayer::onTouchBegan(Touch* touch, Event* event) { return true; }
void WjjnLayer::onTouchMoved(Touch* touch, Event* event) { }
void WjjnLayer::onTouchEnded(Touch* touch, Event* event) { }  


具体实现中  先加入以上,在加入stduio中编辑的控件button的相关代码 加入触摸序列  是按钮优先级大于上面的优先级


如何让自定义Layer触发触摸事件?

复制代码
bool  LayerXXX::init(){  
 
this->setTouchEnabled( true );  
CCTouchDispatcher
* td = CCDirector::sharedDirector()-> getTouchDispatcher();  
td
->addTargetedDelegate( this0true);  // kCCMenuHandlerPriority - 10   //  ... }
复制代码

CCTouchDispatcher是管理cocos2d-x中所有Touch事件派发的类,

CCTouchDispatcher中包含了两个CCTouchHandler的列表,
分别存储StandardTouchHandler和 TargetedTouchHandler。

属性:
this->mTouchPriporty

Layer 优先级越小越高
越低越先响应事件

实验一:当两个Layer优先级同等的时候会怎么样呢?

实验发现,同等优先级下,后添加的Layer先响应事件。

复制代码
// ------------------------------- // Touch1 100 // Touch2 100
 
Touch1Layer* touch1layer = Touch1Layer::create( ccc4f( 255, 0, 0, 128),  100100  );
 
this-> addChild( touch1layer );
touch1layer
->setPosition( 200100 );
Touch2Layer
* touch2layer = Touch2Layer::create( ccc4f( 255, 255, 0, 128),  100100  );
 
this-> addChild( touch2layer );
touch2layer
->setPosition( 250100 );
 
// 结果: // Touch2 // Touch1 // ------------------------------- // Touch1 100 // Touch2 100
 
Touch2Layer* touch2layer = Touch2Layer::create( ccc4f( 255, 255, 0, 128),  100100  );
 
this-> addChild( touch2layer );
touch2layer
->setPosition( 250100 );
Touch1Layer
* touch1layer = Touch1Layer::create( ccc4f( 255, 0, 0, 128),  100100  );
 
this-> addChild( touch1layer );
touch1layer
->setPosition( 200100 );
//结果:Touch1Touch2
-------------------------------
Touch1  100
 
Touch2  99
 
Touch2Layer* touch2layer = Touch2Layer::create( ccc4f( 255, 255, 0, 128),  100100  );
 
this-> addChild( touch2layer );
touch2layer
->setPosition( 250100 );
Touch1Layer
* touch1layer = Touch1Layer::create( ccc4f( 255, 0, 0, 128),  100100  );
 
this-> addChild( touch1layer );
touch1layer
->setPosition( 200100 );
 
// 结果: // Touch2 // Touch1 // 说明优先级越小越先触发事件 // -------------------------------
复制代码

如何阻塞事件的向后传递?

原理:
mSwallowsTouches = false的时候,该层的touch事件若接受处理后,touch事件穿透,进入下个注册touch事件的layer进行处理

若mSwallowsTouches = true时,当该层处理touch事件的时候,若bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
return true时候,则touch事件被该层接收走,其他优先级较低的,就不会接收到touch事件的处理申请了。

关于ccTouchBegan的返回值
true:
本层的后续Touch事件可以被触发,并阻挡向后层传递
false:
本层的后续Touch事件不能被触发,并向后传递

总结:

如何阻塞事件的向后传递?

主要是利用了TargetedTouchDelegate 的一个叫SwallowTouch的参数 ,如果这个开关打开的话,

比他权限低的handler 是收不到 触摸响应的,这里的权限低的意思是先看priority(priority越低的优先级越高)再看哪个Layer最后addChild进去(越后添加的优先级越高)。

CCMenu 就是开了Swallow 并且权限为-128(权限是越小越好),所以CCMenu的事件不会出现击穿

mSwallowsTouches = true 并且 ccTouchBegan 返回 true

如何让Layer所有触摸同时穿透Begin、Move、End事件?

mSwallowsTouches = false 并且 ccTouchBegan 返回 true

ccTouchBegan 返回 true 表示同层处理后续事件(吞噬)
ccTouchBegan 返回 false 表示同层不处理后续事件(Move End Cancled)  (击穿)

mSwallowsTouches 设为 true 表示触摸不向下层传递(不一定 如mSwallowsTouches为true began返回false还是会向后传递)
mSwallowsTouches 设为 false 表示触摸向下层传递(不知有啥用)

this->mTouchPriporty 越小,越先接收到触摸

this->mTouchPriporty 同等,越后addChild的越先响应

如何管理多个对话框的优先级?

事件的优先级和绘图的优先级的关系和区别?

VertexZ 又是什么?(VertexZ是openGl的z轴)


绘图的优先级叫ZOrder

如何改版绘图的优先级?

如在容器中通过调用
this->reorderChild(CCNode* child, int zOrder);

如何设置触摸事件的优先级?
CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority - 1, layer);

如何得到触摸事件的优先级?
this->mTouchPriporty (CCNode类成员 私有变量)

如何遍历容器获取特定的对象??

void Touch1Layer::setFocus()
{
// zorder=1;  priority= kCCMenuTouchPriority - 2;
// zorder
SceneController::GetInstancePtr()->getCurLayer()->reorderChild(this, 1);
// 
CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority - 2, this);
}
void Touch1Layer::loseAllFocus()
{
// 
CCArray* arrChilds = SceneController::GetInstancePtr()->getCurLayer()->getChildren();
for(int i=0; i< arrChilds->count(); i++)
{
CCLayerColor* layer = dynamic_cast< CCLayerColor* >( arrChilds->objectAtIndex(i) );
// ()
if(layer != NULL && layer != this)
{
// zorder=0;  priority= kCCMenuTouchPriority - 1;
SceneController::GetInstancePtr()->getCurLayer()->reorderChild(layer, 0);
CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority - 1, layer);
}
}
}
 

如何判断点在矩形内部?

 
CCPoint pos = this->getPosition();
CCSize size = this->getContentSize();
CCRect rect(pos.x, pos.y, size.width, size.height);
if( CCRect::CCRectContainsPoint(rect, point)  )
{
}
 


z值大的成员在z值小的成员的上面;

官方解释:

Differences between openGL Z vertex and cocos2d Z order:
   - OpenGL Z modifies the Z vertex, and not the Z order in the relation between parent-children
   - OpenGL Z might require to set 2D projection
   - cocos2d Z order works OK if all the nodes uses the same openGL Z vertex. eg: vertexZ = 0

@warning: Use it at your own risk since it might break the cocos2d parent-children z order  
http://www.15wanjia.com/news/12329.html

相关文章:

  • 阜阳做网站的公司多用户建站平台
  • 专做展厅设计网站长沙seo行者seo09
  • 新乡做网站的公司有那些今日新闻播报
  • 常州高端网站制作公司排名seo教程技术
  • 郑州网站建设 个人工作室百度大搜是什么
  • 济南网站建设模板自动友链网
  • 哪里的佛山网站建设seo搜索引擎优化是通过优化答案
  • 十大免费论文网站seo自学网官方
  • 工程做网站百度推广客户端怎样注册
  • 仿淘宝网站网店运营策划方案
  • 微信公众号怎么做微网站吗北京seo
  • csgo翻硬币网站怎么做网站做优化
  • 自己做网站可以挣钱吗杭州网站搜索排名
  • 哪有做网站的 优帮云网站优化推广教程
  • 东莞网站没计广告代运营
  • 给非吸公司建设网站百度网址安全检测中心
  • 如何建设学校网站佛山百度快照优化排名
  • 傻瓜式建网站杭州排名优化公司电话
  • 企业网站无线端怎么做青岛的seo服务公司
  • wordpress404设置搜狗搜索引擎优化论文
  • 做第三方库网站想建立自己的网站
  • 望野古诗带拼音seo网络推广技术员招聘
  • wordpress美化登录什么优化
  • 网站怎么做301seo引擎优化教程
  • 做网站用图片算侵犯著作权吗百度正版下载
  • 苏州高端网站设计seo优化培训课程
  • wordpress 前台 上传北京seo课程
  • 承接网站建设文案微信软文是什么意思
  • 选择网站做友情链接的标准一般是seo是什么工作内容
  • 做网站一定需要自己买主机吗重庆seo排