예제 #1
0
        internal bool CanDo()
        {
            switch (Type)
            {
            case LoopType.Seconds:
            {
                return((DateTime.Now - LastRunTime).TotalSeconds > Pram.ToInt());
            }

            case LoopType.Day:
            {
                if (Pram.Length != 6)
                {
                    throw new Exception($"参数{Pram}非法,必须是HHMMSS结构");
                }
                int h = Pram.Substring(0, 2).ToInt();
                int m = Pram.Substring(2, 2).ToInt();
                int s = Pram.Substring(4, 2).ToInt();
                if (LastRunTime.Date < DateTime.Now.Date)
                {
                    if (DateTime.Now.Hour >= h && DateTime.Now.Minute >= m && DateTime.Now.Second >= s)
                    {
                        return(true);
                    }
                }
                return(false);
            }

            case LoopType.Cron:
                throw new Exception("还没写");

            default:
                throw new Exception($"未知的循环类型{Type}");
            }
        }
    // シリアライズ関数
    public static string JsonSerialize(Transform syncTransform)
    {
        // パラメータを詰める
        Pram tmp = new Pram();

        tmp.Name     = "Chara";
        tmp.Position = syncTransform.position;
        tmp.Rotation = syncTransform.rotation;

        // json形式で返却
        return(JsonUtility.ToJson(tmp));
    }
        public override bool Run(FileInfo buildTarget)
        {
            try
            {
                var runTargets = new Pram().Discover(new[] { "appledevice" });

                // if any devices were found, only pick first
                if (runTargets.Any())
                {
                    runTargets = new[] { runTargets.First() }
                }
                ;

                if (!runTargets.Any())
                {
                    throw new Exception("No iOS devices available");
                }

                var applicationId = Identifier?.PackageName;
                foreach (var device in runTargets)
                {
                    UnityEditor.EditorUtility.DisplayProgressBar("Installing Application", $"Installing {applicationId} to {device.DisplayName}", 0.2f);
                    device.Deploy(applicationId, buildTarget.FullName);

                    UnityEditor.EditorUtility.DisplayProgressBar("Starting Application", $"Starting {applicationId} on {device.DisplayName}", 0.8f);
                    device.ForceStop(applicationId);
                    device.Start(applicationId);
                }
            }
            catch (Exception ex)
            {
                UnityEngine.Debug.LogError(ex.ToString());
                return(false);
            }
            return(true);
        }