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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

2018.8.14笔记

發布時間:2025/3/18 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2018.8.14笔记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2018.8.14筆記


setsiblingindex(idx)設置兄弟結點先后順序時,若idx處已有結點X,則結點X及其后的所有節點后移

gc alloc,就是申請堆內存,堆內存申請無處不在,不可能保持為0,
U3D文檔中說,盡可能保持這個值為0,是說在UPDATE中,因為UPDATE是個頻繁調用的函數,
就算每幀有一點內存申請,時間累積下來也就會有很多,就會引發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】

一,對擴展開放,對修改封閉
1,模板方法: 有一個固定的算法框架,但算法的各步驟允許重寫,利用虛函數讓子類重寫
2,策略模式 有多種方法可以靈活切換時,
例: 各國稅收計算
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,在其中調用 funclassA或funclassB或 funclassC中的Operation

var abstract* pabs = new impAbs()
pabs->SetImpl(new funclassA())
pabs->RefinedOperation() //調用A的operation,并在其基礎上進行優化
pabs->SetImpl(new funclassB())
pabs->RefinedOperation()//調用B的operation,并在其基礎上進行優化

5,工廠模式
5.1簡單工廠模式
把對象的生成放到一個工廠函數中,使用者只需傳入類型就能得到產品
car = factory.CreateCar("bwm")
其中 CreateCar只是簡單的通過if else來new不同對象并返回
5.2工廠方法模式
因為簡單工廠在增加新類型產品時需要修改 CreateCar,違反了對修改封閉,對擴展開放原則,
因此考慮將變化封裝出來,于是便有了工廠方法模式
bmwFactory, benchiFactory, xcarFactory
bmw = bmwFactory.createCar()
benchi = benchiFactory.createCar()
5.3抽象工廠方法模式,在5.2基礎上進行更多的工廠類,并有抽象基類
6,命令模式: 命令發送者-命令-接收者,發送者和接收者通過命令解耦
發送者執行命令,命令調用接收者,接收者執行動作
-------------------------------------------------------------------------------
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,中介模式,很簡單的一個模式,它和代理模式的區別?
中介注重于A,B兩個類不直接交互,而是通過中介交換信息,就像中介所介紹對象
代理模式側重于代理A去做事,可能是向B交互,也可能是更廣義的做任務事
代理主要是為了給A包裝一層,可用于安全處理等

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

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

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

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

四,Reducing mobile .NET library size

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

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

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。