{ "Id": "", "GameId": "", "EntryKey": "codeblock://63fe07f0-2bcd-462c-8157-d6031e053b5e", "ContentType": "x-mod/codeblock", "Content": "", "Usage": 0, "UsePublish": 1, "UseService": 0, "CoreVersion": "26.5.0.0", "StudioVersion": "", "DynamicLoading": 0, "ContentProto": { "Use": "Json", "Json": { "CoreVersion": { "Major": 0, "Minor": 2 }, "ScriptVersion": { "Major": 1, "Minor": 0 }, "Description": "", "Id": "63fe07f0-2bcd-462c-8157-d6031e053b5e", "Language": 1, "Name": "UIToast", "Type": 5, "Source": 0, "Target": null, "Properties": [ { "Type": "Component", "DefaultValue": "7af9e538-1713-49f7-a83e-711c0f4b4a3c:TextComponent", "SyncDirection": 0, "Attributes": [], "Name": "message" }, { "Type": "Entity", "DefaultValue": "0bc398f9-29cb-4d89-a78d-f24742b117e8", "SyncDirection": 0, "Attributes": [], "Name": "toastGroup" }, { "Type": "number", "DefaultValue": "2", "SyncDirection": 0, "Attributes": [], "Name": "duration" }, { "Type": "number", "DefaultValue": "0.1", "SyncDirection": 0, "Attributes": [], "Name": "tweenDuration" }, { "Type": "number", "DefaultValue": "0", "SyncDirection": 0, "Attributes": [], "Name": "tweenEventId" }, { "Type": "boolean", "DefaultValue": "false", "SyncDirection": 0, "Attributes": [], "Name": "isTweenPlaying" }, { "Type": "boolean", "DefaultValue": "false", "SyncDirection": 0, "Attributes": [], "Name": "inited" }, { "Type": "number", "DefaultValue": "0", "SyncDirection": 0, "Attributes": [], "Name": "offset" } ], "Methods": [ { "Return": { "Type": "void", "DefaultValue": null, "SyncDirection": 0, "Attributes": [], "Name": null }, "Arguments": [ { "Type": "string", "DefaultValue": null, "SyncDirection": 0, "Attributes": [], "Name": "message" } ], "Code": "if self.inited == false then\n\tself.inited = true\n\tself.offset = -self.message.Entity.UITransformComponent.anchoredPosition.y\nend\nself.message.Text = message\nself:StartTween()", "Scope": 2, "ExecSpace": 6, "Attributes": [], "Name": "ShowMessage" }, { "Return": { "Type": "void", "DefaultValue": null, "SyncDirection": 0, "Attributes": [], "Name": null }, "Arguments": [], "Code": "local canvasGroup = self.message.Entity.CanvasGroupComponent\nlocal transform = self.message.Entity.UITransformComponent\nif self.tweenEventId > 0 then\n\t_TimerService:ClearTimer(self.tweenEventId)\n\tself.tweenEventId = 0\nelse\n\tcanvasGroup.GroupAlpha = 0\nend\nself.toastGroup.Enable = true\nlocal time = 0\n\nlocal preTime = _UtilLogic.ElapsedSeconds\n\nlocal tween = function()\n\tlocal delta = _UtilLogic.ElapsedSeconds - preTime\n\ttime = time + delta\n\tpreTime = _UtilLogic.ElapsedSeconds\n\n\tlocal alpha = canvasGroup.GroupAlpha \n\tif time >= (self.duration + self.tweenDuration) then\t\t\n\t\tself.toastGroup.Enable = false\n\t\t_TimerService:ClearTimer(self.tweenEventId)\n\t\tself.tweenEventId = 0\n\t\talpha = 0\n\telse\n\t\tif time > self.duration then\t\t\t\n\t\t\talpha = alpha - delta / self.tweenDuration\n\t\telse\n\t\t\talpha = alpha + delta / self.tweenDuration\n\t\tend\t\t\t\n\tend\t\n\talpha = math.min(1,math.max(alpha,0))\n\t\n\tcanvasGroup.GroupAlpha = alpha\n\tlocal tweenValue = _TweenLogic:Ease(0,1,1,EaseType.SineEaseIn,alpha)\n\ttransform.anchoredPosition = Vector2(0,-self.offset * tweenValue)\nend\n\nself.tweenEventId = _TimerService:SetTimerRepeat(tween,1/60)\n\n", "Scope": 2, "ExecSpace": 0, "Attributes": [], "Name": "StartTween" } ], "EntityEventHandlers": [] } } }