杂七杂八记录
tolua使用Dotween function test() function Complete () logWarn("动画完成回调!") end local pos = go.transform.position; local sequence = DG.Tweening.DOTween.Sequence() --动画列队 sequence:Append(go.transform:DORotate(Vector3(0,0,360), 1, DG.Tweening.RotateMode.FastBeyond360)); sequence:Join(go.transform:DOShakePosition (2, Vector3.New(2, 2, 3))); sequence:Append(go.transform:DOJump(Vector3.New(pos.x+100, pos.y, pos.z),5,3,3)); sequence:Append(go.transform:DOMove (Vector3.New(20, 20, 30),2)):SetEase(DG.Tweening.Ease.Linear); sequence:Append(go.transform:DOMove (Vector3.New(70, 80, 30),2)):SetEase(DG.Tweening.Ease.OutQuad); sequence:Append(go.transform:DOMove (Vector3.New(120, 120, 30),2)):SetEase(DG.Tweening.Ease.InOutCubic); sequence:Append(go.transform:DOMove (Vector3.New(200, 200, 30),2)):SetEase(DG.Tweening.Ease.InCirc); local cityScene = GameObject.FindWithTag("cityScene").transform; local house = cityScene:FindChild("house").gameObject; local pathTable = { Vector3.New(17, 10, 5.7), Vector3.New(1, 10, 0), Vector3.New(1, 10, 20), Vector3.New(11, 10, 10) }; sequence:Append(house.transform:DOLocalPath(pathTable, 12, DG.Tweening.PathType.Linear, DG.Tweening.PathMode.Full3D, 10, nil)); sequence:Append(self.worldCamera.transform:DOLookAt(Vector3.New(0, 1, 0), 20, DG.Tweening.AxisConstraint.Y)); sequence:Play(); sequence:OnComplete(Complete); end
--修改RectTransform的值 function test() local targetRectTransform = targetObject:GetComponent('RectTransform'); --1.改变RectTransform的top targetRectTransform.offsetMax = Vector2.New(0, 0); --2.改变RectTransform的bottom targetRectTransform.offsetMin = Vector2.New(0, 0); --3.改变RectTransform的width,height targetRectTransform.sizeDelta = Vector2.New(0, 0); --4.改变RectTransform的pos targetRectTransform.anchoredPosition3D = Vector3.New(0, 0); targetRectTransform.anchoredPosition = Vector2.New(0, 0); end
博客地址:http://blog.csdn.net/MyCodecOdecoDecodE/article/details/71445408?locationNum=4&fps=1
local te = go.transform:DOMoveY(VectorPos.y, 3):SetEase(DG.Tweening.Ease.InOutSine); function Complete () logWarn("动画完成回调!") te:Pause(); go.transform:DOScale(3, 1); go.transform:DOMoveY(0, 1.5):SetEase(DG.Tweening.Ease.OutBounce); end local sequence = DG.Tweening.DOTween.Sequence() --动画列队 sequence:Append(go.transform:DOMoveX(VectorPos.x + 75, 1.5):SetEase(DG.Tweening.Ease.OutSine)); sequence:Append(go.transform:DOMoveX(VectorPos.x - 75, 1.5):SetEase(DG.Tweening.Ease.InSine)); sequence:Play(); sequence:OnComplete(Complete);
function EditBuildingCtr:testMove( Pos ) if self.testAstae then local ray = self.componentCamera:ScreenPointToRay(Pos); local _layer = 2 ^ LayerMask.NameToLayer('TerrainLayer'); local flag, hit = UnityEngine.Physics.Raycast(ray, nil, 5000, _layer); if flag then local touchPos = hit.point local orderpos = self.testAstae.transform.position self.testAstae.transform.position = touchPos; touchPos = self.testAstae.transform.localPosition; self.testAstae.transform.position = orderpos; for i = 1,#self.touchPaceTable do local placeInfo = self.touchPaceTable[i]; local isContains , pos = self:Contains(touchPos,placeInfo["pos"]); if isContains then --测试A星寻路 if self.toolAstar ~= nil then local fromPos = Vector3.New(self.testAstae.transform.localPosition.x,self.testAstae.transform.localPosition.z,self.testAstae.transform.localPosition.z); local toPos = Vector3.New(touchPos.x,touchPos.z,touchPos.z); self.toolAstar:moveToward(fromPos,toPos); end break; end end end end end
Vector3[] paths = new [] { new Vector3(1, 2, 2), new Vector3(8, 0, 4), new Vector3(9, 2, 14), new Vector3(5, 4, 10), new Vector3(2, 4, 4) } // PathType.CatmullRomは滑らかな曲線を描いて移動します Tweener tween = target.DOPath(paths, 2.0f, PathType.CatmullRom);
可以为DOPath设置选项。 1 2 // trueにすると自動的に元の位置に戻ります Tweener tween = target.DOPath(paths, 2.0f, PathType.CatmullRom).SetOptions(true); 也可以将其设置为不移动X轴和Y轴的选项。 1 Tweener tween = target.DOPath(paths, 2.0f, PathType.CatmullRom).SetOptions(true,AxisConstraint.Y);
当使用Path移动时,您可以设置您正在面向哪个方向。 通过指定具有特定值或指定的对象,当使用Path移动时,它将指向该方向。 Tweener tween = target.DOPath(paths, 2.0f, PathType.CatmullRom) .SetOptions(true) .SetLookAt(target.transform.position);
ai_family参数指定调用者期待返回的套接口地址结构的类型。它的值包括三种:AF_INET,AF_INET6和AF_UNSPEC。如果指定AF_INET,那么函数九不能返回任何IPV6相关的地址信息;如果仅指定了AF_INET6,则就不能返回任何IPV4地址信息。AF_UNSPEC则意味着函数返回的是适用于指定主机名和服务名且适合任何协议族的地址。如果某个主机既有AAAA记录(IPV6)地址,同时又有A记录(IPV4)地址,那么AAAA记录将作为sockaddr_in6结构返回,而A记录则作为sockaddr_in结构返回。