1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System.Collections;
- using System.Linq;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- using KairoEngine.Core;
- namespace KairoEngine.Core.GameActions
- {
- [System.Serializable, HideReferenceObjectPicker]
- public class OpenUrlGameAction : GameActionBase
- {
- #region DefaultVariables
- public override string name { get => $"Open URL ({url}) "; }
- public override GameActionsController controller {
- get => _controller;
- set
- {
- _controller = value;
- typeName = "OpenUrlGameAction";
- }
- }
- public override string GetTypeName() => "OpenUrlGameAction";
- public override string GetActionName() => "Core/Open URL";
- #endregion
- #region ActionVariables
- [FoldoutGroup("@name")] public string url = "https://www.example.com";
- #endregion
- public OpenUrlGameAction(GameActionsController controller) : base(controller)
- {
- this.controller = controller;
- className = this.GetType().AssemblyQualifiedName;
- }
- #region Flow
- public override void Start()
- {
- Application.OpenURL(url);
- _done = true;
- _started = true;
- }
- public override void Update()
- {
- }
- public override void Restart()
- {
- _done = false;
- _started = false;
- }
- #endregion
- #region Utilities
- private OpenUrlGameAction Duplicate(GameActionsController controller = null)
- {
- OpenUrlGameAction action = new OpenUrlGameAction(controller == null ? this.controller : controller);
- action.controller = controller;
- action.url = url;
- return action;
- }
- #endregion
- #region Serialization
- public static OpenUrlGameAction JSONToOpenUrlGameAction(string data)
- {
- return JsonUtility.FromJson<OpenUrlGameAction>(data);
- }
- #endregion
- }
- }
|