如果要達成上圖效果,在3.0.0版本後就有cc.RenderRoot2D可以使用,直接在Label上或是Sprite上Add Component就好。詳細可以見官網!
但是3版以前的並沒有這麼支援3D的功能!
在我一番搜尋+瞎貓碰到死耗子的狀況,終於搞定了這個功能。
下收做法:
2021年10月27日
2021年10月22日
2021年10月17日
2021年10月15日
[筆記]比較UTC時間
new Date是非常好用的語法,不管是給UTC時間、還是地區時間,都可以幫你無痛轉成UTC的時間。
比較也是很簡單!直接做比較運算子就好!
比較也是很簡單!直接做比較運算子就好!
let nowDate: Date = new Date();
let endDate: Date = new Date( "2021-10-15T12:00:00+00:00");
let myDate: Date = new Date( "2021-10-15T16:22:00");
console.log(nowDate);
console.log(endDate);
console.log(myDate);
if (nowDate > endDate){
console.log("Bigger");
}else{
console.log("Smaller");
}
if (nowDate > myDate){
console.log("Bigger");
}else{
console.log("Smaller");
}
結果:
[LOG]: nowDate: "2021-10-15T08:22:47.110Z" [LOG]: endDate: "2021-10-15T12:00:00.000Z" [LOG]: myDate: "2021-10-15T08:22:00.000Z" [LOG]: nowDate vs endDate => "Smaller" [LOG]: nowDate vs myDate => "Bigger"
2021年9月2日
[筆記]讓金幣依照菱形圖案去跳舞
private List CoinPos = new List();
private void CreateCoinPos()
{
Vector3 offset = new Vector3(0, 20, 0);
CoinPos.Clear();
int _Diameter = 4;
int _Distance = 60;
for (int x = -_Diameter; x < _Diameter + 1; x++)
{
int r = Math.Abs(x % 2);
int dis = _Diameter - Math.Abs(x);
for (int y = -dis; y < dis + 1; y++)
{
int ry = Math.Abs(y % 2);
if (ry != r)
continue;
Vector3 _Pos = new Vector3(x * _Distance, y * _Distance, 0);
_Pos += offset;
CoinPos.Add(_Pos);
}
}
CoinPos.Sort(delegate(Vector3 a, Vector3 b)
{
float ad = Vector3.Distance(a, Vector3.zero);
float bd = Vector3.Distance(b, Vector3.zero);
if (ad < bd) return -1;
if (ad > bd) return 1;
return 0;
});
}
public void DropCoin(int Length)
{
}
2021年5月15日
渲染順序 Rendering order
最近有同事在研究NGUI與UGUI的渲染順序關係(假如用同一個camera下),不過今天不是想講這個議題,而是來講講渲染順序。
當然也是有參考一些網路上的文章,本文主要是我看完後吸收到的結論。
以下圖片是實作渲染順序,如果看不懂…請再跟我說。(以下皆使用2017.4.3f1)
當然也是有參考一些網路上的文章,本文主要是我看完後吸收到的結論。
以下圖片是實作渲染順序,如果看不懂…請再跟我說。(以下皆使用2017.4.3f1)
2020年2月5日
[工具]替換Component(Script)小工具
2019年7月4日
2019年6月13日
訂閱:
文章 (Atom)

