日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

2018.8.14笔记

發(fā)布時(shí)間:2025/3/18 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2018.8.14笔记 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

2018.8.14筆記


setsiblingindex(idx)設(shè)置兄弟結(jié)點(diǎn)先后順序時(shí),若idx處已有結(jié)點(diǎn)X,則結(jié)點(diǎn)X及其后的所有節(jié)點(diǎn)后移

gc alloc,就是申請堆內(nèi)存,堆內(nèi)存申請無處不在,不可能保持為0,
U3D文檔中說,盡可能保持這個(gè)值為0,是說在UPDATE中,因?yàn)閁PDATE是個(gè)頻繁調(diào)用的函數(shù),
就算每幀有一點(diǎn)內(nèi)存申請,時(shí)間累積下來也就會(huì)有很多,就會(huì)引發(fā)GC。

Note that some script methods cause allocations when running in the Editor, but do not produce allocations after the project has been built. GetComponent is the most common example; this method always allocates when executed in the Editor, but not in a built project.
【Understanding the managed heap】

一,對擴(kuò)展開放,對修改封閉
1,模板方法: 有一個(gè)固定的算法框架,但算法的各步驟允許重寫,利用虛函數(shù)讓子類重寫
2,策略模式 有多種方法可以靈活切換時(shí),
例: 各國稅收計(jì)算
stra->stra1,stra2,stra3
var ps = setstretage(new stra1())
ps->calc()
var ps1 = setstretage(new stra2())
ps1->calc()
二,解決功能類組合爆炸
3,裝飾者模式,
stream->filestream,networkstream,memorystream
bufferedStream, cryptoStream, ....
var b1 = new bufferedStream(new filestream())
var b2 = new bufferedStream(new networkstream())
var b3 = new bufferedStream(new memorystream())
new cryptoStream(b1)
new cryptoStream(b2)
new cryptoStream(b3)
new cryptoStream(new filestream())
new cryptoStream(new networkstream())
new cryptoStream(new memorystream())

4,橋接模式 bridge,與裝飾者模式有很像,感覺像是裝飾模式和策略模式的合體
abstract-> impAbs
funclassA,funclassB, funclassC
其中:impAbs中有 RefinedOperation,在其中調(diào)用 funclassA或funclassB或 funclassC中的Operation

var abstract* pabs = new impAbs()
pabs->SetImpl(new funclassA())
pabs->RefinedOperation() //調(diào)用A的operation,并在其基礎(chǔ)上進(jìn)行優(yōu)化
pabs->SetImpl(new funclassB())
pabs->RefinedOperation()//調(diào)用B的operation,并在其基礎(chǔ)上進(jìn)行優(yōu)化

5,工廠模式
5.1簡單工廠模式
把對象的生成放到一個(gè)工廠函數(shù)中,使用者只需傳入類型就能得到產(chǎn)品
car = factory.CreateCar("bwm")
其中 CreateCar只是簡單的通過if else來new不同對象并返回
5.2工廠方法模式
因?yàn)楹唵喂S在增加新類型產(chǎn)品時(shí)需要修改 CreateCar,違反了對修改封閉,對擴(kuò)展開放原則,
因此考慮將變化封裝出來,于是便有了工廠方法模式
bmwFactory, benchiFactory, xcarFactory
bmw = bmwFactory.createCar()
benchi = benchiFactory.createCar()
5.3抽象工廠方法模式,在5.2基礎(chǔ)上進(jìn)行更多的工廠類,并有抽象基類
6,命令模式: 命令發(fā)送者-命令-接收者,發(fā)送者和接收者通過命令解耦
發(fā)送者執(zhí)行命令,命令調(diào)用接收者,接收者執(zhí)行動(dòng)作
-------------------------------------------------------------------------------
public interface ICommand{
void Execute();
}
public class ConcreteCommandA : ICommand{
public ConcreteCommandA(Receiver receiver){this.receiver = receiver;}
public void Execute(){this.receiver.DoA();}
}
public class ConcreteCommandB : ICommand{
private Receiver receiver = null;
public ConcreteCommandB(Receiver receiver)
public void Execute(){this.receiver.DoB();}
}
public class Receiver
public void DoA(){}
public void DoB(){}
}
public class Invoker{
public void SetCommand(ICommand command)
public void RunCommand(){ command.Execute(); }
}
public class Client
{
public Client()
{
Receiver receiver = new Receiver();
Invoker invoker = new Invoker();
invoker.SetCommand(new ConcreteCommandA(receiver));
invoker.RunCommand();
invoker.SetCommand(new ConcreteCommandB(receiver));
invoker.RunCommand();
}
}
-------------------------------------------------------------------------------
7,中介模式,很簡單的一個(gè)模式,它和代理模式的區(qū)別?
中介注重于A,B兩個(gè)類不直接交互,而是通過中介交換信息,就像中介所介紹對象
代理模式側(cè)重于代理A去做事,可能是向B交互,也可能是更廣義的做任務(wù)事
代理主要是為了給A包裝一層,可用于安全處理等

8,代理模式,將A放入代理類B中,通過B操作A

————————————————————————————————————————————————————————————

1,頂點(diǎn)壓縮,reduces the file size of the Mesh, but might introduce irregularities.
2,查看build log,可以看到各種類型的資源所占有空間大小,及空間占用從大到小排列的具體各資源的列表
3,U3D在導(dǎo)入紋理時(shí)是邊導(dǎo)邊壓縮的,因此導(dǎo)入圖片會(huì)很慢,在開發(fā)時(shí)可以關(guān)掉這個(gè)選項(xiàng):prefercen, compress asset on import

減小打包尺寸
一,紋理
1,選擇合適的紋理壓縮方式
2,更改紋理尺寸:并不需要改實(shí)際圖片,只需要在設(shè)置中更改max size就行了
3,2的N次方規(guī)則+4N規(guī)則
二,MESH
1,模型屬性面板的MODEL分頁卡中選擇Mesh Compression low/medium/high
這可以減小打包的MESH大小,但可能會(huì)導(dǎo)致不精確(動(dòng)作,蒙皮等),手冊上說這并不會(huì)減小運(yùn)行內(nèi)存
其實(shí)應(yīng)該也是會(huì)的,因?yàn)槟P晚旤c(diǎn)少了啊,若說在運(yùn)行時(shí)頂點(diǎn)數(shù)目又通過某種算法還原了,倒有可能。
2,減小關(guān)鍵幀數(shù)量
Animation keyframe reduction produces smaller data files and uses less memory at run time; generally you should always have it enabled.
這個(gè)是可以很明顯的減小運(yùn)行內(nèi)存,又可以減小打包尺寸
三,DLL
U3D必須的幾個(gè)DLL: mscorlib.dll boo.lang.dll unityscript.lang.dll unityengine.dll
默認(rèn)情況下不帶system.dll,system.xml.dll,這兩個(gè)DLL大約1M多,當(dāng)使用了相關(guān)類時(shí),這兩個(gè)DLL會(huì)被自動(dòng)導(dǎo)入

四,Reducing mobile .NET library size

avatar存在的目的: 1,動(dòng)作遮罩,2,動(dòng)作重定向
------------------------------------
Animation Layer syncing????
------------------------------------
重定向???

posted on 2018-08-14 08:13 時(shí)空觀察者9號(hào) 閱讀(...) 評論(...) 編輯 收藏

總結(jié)

以上是生活随笔為你收集整理的2018.8.14笔记的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。