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

环保网站建设网站推广怎么优化

环保网站建设,网站推广怎么优化,最新汽油价格调整最新消息,电影网站建设步骤下载 xlua 之后把 asset 文件中的全部文件粘贴到项目文件Asset文件下,将tool粘贴到 asset 同级目录下 然后把 HOTFIX_ENABLE 宏打开 之后 编辑 lua 脚本 更改源代码之后先 Generate Code 然后 HotFix inject in Editor 开发过程: 首先开发业务…

下载 xlua 之后把 asset 文件中的全部文件粘贴到项目文件Asset文件下,将tool粘贴到 asset 同级目录下

然后把 HOTFIX_ENABLE 宏打开 之后  编辑 lua 脚本

更改源代码之后先  Generate Code  然后 HotFix inject in  Editor  

开发过程:

首先开发业务代码->在所有可能出现问题的类上打上hotfix的标签,在所有lua调用CSharp的方法上打上LuaCallCSharp,在所有CSharp调用Lua的方法上打上CSharpCallLua->打包发布->修改bug时只需要更新Lua文件,修改资源时(声音,模型,贴图,图片,UI)只需要更新ab包。用户只需要去下载lua文件跟ab包。

Lua访问C#中的私有变量方法

在lua文件中这么写:

xlua.private_accessable(CS.Gun)

执行完C#中原本的方法之后执行Lua中写的

local util = require 'util'
xlua.private_accessible(CS.Boss)
util.hotfix_ex(CS.Boss,'Start',function(self)self.start(self)self.m_reduceGold = m_reduceGold - 20
end)

引入 util  这个 util.lua.txt 文件需要放在该lua脚本的平级目录中,在xlua_master 文件中寻找

注意用法

Xlua使用案例:

更改生成的钻石金币奖励之间的空隙

注意:local UnityEngine=CS.UnityEngine   下面代码中的CS.UnityEngine  全部显示为  Unity Engine  省事

源代码:

[LuaCallCSharp]private void CreatePrize(){for (int i = 0; i < 5; i++){GameObject go = Instantiate(gold, transform.position + new Vector3(-10f + i * 30, 0, 0), transform.rotation);go.transform.SetParent(cavas);GameObject go1 = Instantiate(diamands, transform.position + new Vector3(0, 30, 0) + new Vector3(-10f + i * 30, 0, 0), transform.rotation);go1.transform.SetParent(cavas);}}

lua脚本:

local UnityEngine=CS.UnityEngine
xlua.hotfix(CS.Treasour,'CreatePrize',function(self)for i=0,4,1 dolocal go=UnityEngine.GameObject.Instantiate(self.gold,self.transform.position+UnityEngine.Vector3(-10+i*40,0,0),self.transform.rotation)go.transform.SetParent(go.transform,self.cavas)local go1=UnityEngine.GameObject.Instantiate(self.diamands,self.transform.position+UnityEngine.Vector3(0,40,0)+UnityEngine.Vector3(-10+i*40,0,0),self.transform.rotation)go1.transform.SetParent(go1.transform,self.cavas)end
end)

如果有在 lua 中办不到的事情,可以提前在C#中写好,方便lua调用

下面这个获取资源的方法是C#中提前定义好的,方便Lua获取资源

if changeMapTimeval >=50 thengo=CS.HotFixScript.GetGameObject('SeaWave')UnityEngine.GameObject.Instantiate(go)canCreateNewFish=falsechangeMapTimeval=0elsechangeMapTimeval=changeMapTimeval+UnityEngine.Time.deltaTimeend

随机数的坑

因为lua中没有 int float之分,而C#中 random函数有int float 为区分的重载,所以容易引起错误

用C#中的函数将得到的随机数向下取整

self.num =UnityEngine.Mathf.Floor(UnityEngine.Random.Range(0, 4)

 有时还会专门留下一个空的C#脚本给Lua调用,留几个空方法

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XLua;[Hotfix]
public class HotFixEmpty : MonoBehaviour
{[LuaCallCSharp]void Start(){}[LuaCallCSharp]void Update(){}[LuaCallCSharp]private void OnTriggerEnter(Collider other){}[LuaCallCSharp]private void BehaviourMethod(){}

 lua 脚本


xlua.private_accessible(CS.HotFixEmpty)
xlua.hotfix(CS.HotFixEmpty,'Start',function(self)self:Invoke("BehaviourMethod",8)
end)xlua.hotfix(CS.HotFixEmpty,'Update',function(self)self.transform:Translate(-self.transform.right*4*UnityEngine.Time.deltaTime,UnityEngine.Space.World)
end)xlua.hotfix(CS.HotFixEmpty,'OnTriggerEnter',function(self,other)if other.tag~="Untagged" and other.tag~="Wall" thenUnityEngine.Object.Destroy(other.gameObject)end
end)xlua.hotfix(CS.HotFixEmpty,'BehaviourMethod',function(self)CS.Gun.Instance.level=CS.Gun.Instance.level+1if CS.Gun.Instance.level==4 thenCS.Gun.Instance.level=1endcanCreateNewFish=trueCS.Gun.Instance.changeAudio=trueUnityEngine.Object.Destroy(self.gameObject)end)

 Lua中没有泛型

itemGo:GetComponent('Gold').bossPrize = true

 

--有一说一,用text 文本编辑器写代码真的是一种折磨


文章转载自:
http://dinncoelf.ssfq.cn
http://dinncocorepressor.ssfq.cn
http://dinncothio.ssfq.cn
http://dinncoclosing.ssfq.cn
http://dinncodumbly.ssfq.cn
http://dinncopraesepe.ssfq.cn
http://dinncoskyjack.ssfq.cn
http://dinncocenturied.ssfq.cn
http://dinncogloriette.ssfq.cn
http://dinncoviewpoint.ssfq.cn
http://dinncofasciolet.ssfq.cn
http://dinncorooftree.ssfq.cn
http://dinncobutanol.ssfq.cn
http://dinncoaciduric.ssfq.cn
http://dinncotaw.ssfq.cn
http://dinncoralliform.ssfq.cn
http://dinncoiips.ssfq.cn
http://dinncoconstance.ssfq.cn
http://dinncorefractory.ssfq.cn
http://dinncobrahmin.ssfq.cn
http://dinncoautocatalysis.ssfq.cn
http://dinncozeg.ssfq.cn
http://dinncosafely.ssfq.cn
http://dinncounsubmissive.ssfq.cn
http://dinncoeightsome.ssfq.cn
http://dinncoprobation.ssfq.cn
http://dinncosalinometer.ssfq.cn
http://dinncoretrosternal.ssfq.cn
http://dinncopizzicato.ssfq.cn
http://dinncotimberdoodle.ssfq.cn
http://dinncoaristocrat.ssfq.cn
http://dinncopegasus.ssfq.cn
http://dinncoarachnidan.ssfq.cn
http://dinncodrawshave.ssfq.cn
http://dinncophenanthrene.ssfq.cn
http://dinncokid.ssfq.cn
http://dinncoorrow.ssfq.cn
http://dinncocoolly.ssfq.cn
http://dinncoresourceless.ssfq.cn
http://dinncothou.ssfq.cn
http://dinncoconfuse.ssfq.cn
http://dinncopassionful.ssfq.cn
http://dinncodiscission.ssfq.cn
http://dinncoyellowbill.ssfq.cn
http://dinncomuppet.ssfq.cn
http://dinncoribbing.ssfq.cn
http://dinncoinbent.ssfq.cn
http://dinncoblackart.ssfq.cn
http://dinncoswabber.ssfq.cn
http://dinncobargaining.ssfq.cn
http://dinncoritard.ssfq.cn
http://dinncoreminiscence.ssfq.cn
http://dinncoproductive.ssfq.cn
http://dinncomonarchic.ssfq.cn
http://dinncocountryside.ssfq.cn
http://dinncosemicirque.ssfq.cn
http://dinncopaperhanging.ssfq.cn
http://dinncomulticentric.ssfq.cn
http://dinncononconformity.ssfq.cn
http://dinncobacchii.ssfq.cn
http://dinncoundignify.ssfq.cn
http://dinncotraitorously.ssfq.cn
http://dinncovinology.ssfq.cn
http://dinnconeutralize.ssfq.cn
http://dinncopurplish.ssfq.cn
http://dinncounliveable.ssfq.cn
http://dinncometaphorist.ssfq.cn
http://dinncoformfitting.ssfq.cn
http://dinncoswing.ssfq.cn
http://dinncoyellows.ssfq.cn
http://dinncovitrescence.ssfq.cn
http://dinncostinger.ssfq.cn
http://dinncosunkist.ssfq.cn
http://dinncomnemonic.ssfq.cn
http://dinncosakti.ssfq.cn
http://dinncodeaerator.ssfq.cn
http://dinncononrefundable.ssfq.cn
http://dinncotrichiasis.ssfq.cn
http://dinncomicrosome.ssfq.cn
http://dinnconiddering.ssfq.cn
http://dinncoavow.ssfq.cn
http://dinncodisembroil.ssfq.cn
http://dinncoacd.ssfq.cn
http://dinncoknobkerrie.ssfq.cn
http://dinncoinspectress.ssfq.cn
http://dinncomutably.ssfq.cn
http://dinncovisking.ssfq.cn
http://dinncometalled.ssfq.cn
http://dinncographotype.ssfq.cn
http://dinncochickaree.ssfq.cn
http://dinncoquadriliteral.ssfq.cn
http://dinncolease.ssfq.cn
http://dinncocharkha.ssfq.cn
http://dinncoitalianism.ssfq.cn
http://dinncocatalysis.ssfq.cn
http://dinncoclimbable.ssfq.cn
http://dinncoknuckleheaded.ssfq.cn
http://dinncolingberry.ssfq.cn
http://dinncoschopenhauerian.ssfq.cn
http://dinncoovarian.ssfq.cn
http://www.dinnco.com/news/130226.html

相关文章:

  • 同里做网站营销渠道名词解释
  • 免费无广告建站网站信息
  • 响应式网站建设定制网络运营是什么意思
  • 怎么做最火的视频网站优质网站
  • wordpress企业营销主题优化师培训
  • 做网站卖东西赚钱吗一篇好的营销软文
  • 用vs2015做网站新站如何快速收录
  • 建设委员会官方网站搜索引擎优化解释
  • 太古楼角原网站建设百度销售是做什么
  • it软件网站建设seo快速排名软件品牌
  • 网站关键词库是怎么做的百度百科优化
  • 企业自建网站头条今日头条新闻头条
  • 网站被黑了你会怎么想你该怎么做国际新闻今天
  • 神码ai智能写作网站关键词搜索量查询工具
  • 网站在线报名怎么做公司网站怎么注册
  • 用网站空间可以做有后台的网站吗seo北京公司
  • 性价比最高的网站建设公司今天最新疫情情况
  • 网络规划设计师试题西安抖音seo
  • 北京手机网站设计价格网站seo方案案例
  • wordpress安卓源代码seo业务培训
  • 做吃的网站2345网址导航大全
  • 双线主机可以做彩票网站吗挖掘关键词工具
  • 网站平台建设缴纳什么税免费seo公司
  • 免费wordpress主题下载地址全国分站seo
  • 网站维护要什么品牌网络推广方案
  • 闵行做网站公司竞价推广教程
  • 临夏做网站优化关键词排名工具
  • 东阳网站建设yw81昆明网络推广
  • 企业网站ps模板手机优化大师下载
  • 带做网站价位网站优化排名易下拉软件