Join our Discord Channel
// (c) Copyright HutongGames, LLC 2010-2016. All rights reserved.// Action Made By : DjayDino/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/using UnityEngine;using System.Collections;namespace HutongGames.PlayMaker.Actions{ [ActionCategory("Web")] [Tooltip("Saves highscore to Dreamlo website")] public class DreamloAddScore : FsmStateAction { [RequiredField] [Tooltip("Place Private Code from the Dreamlo website")] public FsmString privateCode; [RequiredField] [Tooltip("Place Public Code from the Dreamlo website")] public FsmString publicCode; [RequiredField] [Tooltip("Place Player Name Here. Player Name Must be urlfriendly (if player name exists it will change to the highest score and not add the name a 2nd time)")] public FsmString PlayerName; [RequiredField] [Tooltip("Place Player Score Here")] public FsmInt PlayerScore; [Tooltip("Place Player Seconds left, Seconds done or any int value you need (level for example)")] public FsmInt Secconds; [Tooltip("Place any String here for example surname or rank (like Sergeant for example)")] public FsmString text; public FsmEvent isError; [Tooltip("Where any errors thrown will be stored. Set this to a variable, or leave it blank.")] public FsmString errorMessage = ""; private WWW www; public override void Reset() { privateCode = null; publicCode = null; PlayerName = null; PlayerScore = null; Secconds = null; errorMessage = ""; } public override void OnEnter() { AddNewHighScore(); Finish(); } public void AddNewHighScore() { if (text != null) { if (Secconds == null) { Secconds = 0; } www = new WWW("http://dreamlo.com/lb/" + privateCode.Value + "/add/" + WWW.EscapeURL(PlayerName.Value) + "/" + PlayerScore.Value + Secconds.Value + WWW.EscapeURL(text.Value)); Debug.Log("Has Text"); } if (Secconds != null & text == null) { www = new WWW("http://dreamlo.com/lb/" + privateCode.Value + "/add/" + WWW.EscapeURL(PlayerName.Value) + "/" + PlayerScore.Value + Secconds.Value); Debug.Log("Has Secconds"); } if (text == null & Secconds == null) { www = new WWW("http://dreamlo.com/lb/" + privateCode.Value + "/add/" + WWW.EscapeURL(PlayerName.Value) + "/" + PlayerScore.Value); Debug.Log("No Text No Secconds"); } } }}