Пример #1
0
        public override string ToString()
        {
            var algorithm = new StringBuilder();

            if (Moves != null)
            {
                for (int i = 0; i < Moves.Count; i++)
                {
                    var move     = Moves[i];
                    var nextMove = i < Moves.Count - 1 ? Moves[i + 1] : null;

                    i = Process(move, nextMove, i, LayerType.Front, "F", algorithm);
                    i = Process(move, nextMove, i, LayerType.Back, "B", algorithm);
                    i = Process(move, nextMove, i, LayerType.Top, "U", algorithm);
                    i = Process(move, nextMove, i, LayerType.Bottom, "D", algorithm);
                    i = Process(move, nextMove, i, LayerType.Left, "L", algorithm);
                    i = Process(move, nextMove, i, LayerType.Right, "R", algorithm);
                }
            }
            else if (IsFlip)
            {
                algorithm.Append($"Flip {Axis.ToString()} in {RotationType.ToString()}");
            }

            return(algorithm.ToString());
        }
        /// <summary>
        /// Post the players score to the given social leaderboard.
        /// Pass leaderboard config data to dynamically create if necessary.
        /// You can optionally send a user-defined json string of data
        /// with the posted score. This string could include information
        /// relevant to the posted score.
        /// </summary>
        /// <remarks>
        /// Service Name - SocialLeaderboard
        /// Service Operation - PostScoreDynamic
        /// </remarks>
        /// <param name="in_leaderboardId">
        /// The leaderboard to post to
        /// </param>
        /// <param name="in_score">
        /// The score to post
        /// </param>
        /// <param name="in_data">
        /// Optional user-defined data to post with the score
        /// </param>
        /// <param name="in_leaderboardType">
        /// leaderboard type
        /// </param>
        /// <param name="in_rotationType">
        /// Type of rotation
        /// </param>
        /// <param name="in_rotationStart">
        /// Date to start rotation calculations (Date is converted to "dd-mm-yyyy" format)
        /// </param>
        /// <param name="in_retainedCount">
        /// Hpw many rotations to keep
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status":200,
        ///   "data":{
        ///   }
        /// }
        /// </returns>
        public void PostScoreToDynamicLeaderboard(
            string in_leaderboardId,
            long in_score,
            string in_jsonData,
            SocialLeaderboardType in_leaderboardType,
            RotationType in_rotationType,
            DateTime in_rotationStart,
            int in_retainedCount,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject         = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.SocialLeaderboardServiceLeaderboardId.Value] = in_leaderboardId;
            data[OperationParam.SocialLeaderboardServiceScore.Value]         = in_score;
            if (Util.IsOptionalParameterValid(in_jsonData))
            {
                Dictionary <string, object> customData = JsonReader.Deserialize <Dictionary <string, object> >(in_jsonData);
                data[OperationParam.SocialLeaderboardServiceData.Value] = customData;
            }
            data[OperationParam.SocialLeaderboardServiceLeaderboardType.Value] = in_leaderboardType.ToString();
            data[OperationParam.SocialLeaderboardServiceRotationType.Value]    = in_rotationType.ToString();
            data[OperationParam.SocialLeaderboardServiceRotationStart.Value]   = in_rotationStart.ToString("d-MM-yyyy");
            data[OperationParam.SocialLeaderboardServiceRetainedCount.Value]   = in_retainedCount;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.SocialLeaderboard, ServiceOperation.PostScoreDynamic, data, callback);

            m_brainCloudClientRef.SendRequest(sc);
        }
Пример #3
0
        public void ChangeType(RotationType rotationType)
        {
            if (_rotationType == rotationType)
            {
                return;
            }

            _rotationType = rotationType;

            Log.Write("Rotation type: " + rotationType, Brushes.GreenYellow);

            Speak(rotationType.ToString());
        }
        private double getRotationValue(RotationType typeR)
        {
            string text = range[0, 32].Text;
            if (typeR == RotationType.Y)
            {
                text = range[0, 33].Text;
            }
            else if (typeR == RotationType.Z)
            {
                text = range[0, 34].Text;
            }

            if (string.IsNullOrEmpty(text.Trim()))
            {
                //this.writeError("未填写,默认为0", "板件绕" + typeR.ToString() + "旋转角度");
                return 0;
            }

            return GetDoubleValue(text, "板件绕" + typeR.ToString() + "旋转角度", false, errors);
        }
Пример #5
0
        public void ChangeType(RotationType rotationType)
        {
            if (_rotationType == rotationType)
            {
                return;
            }

            _rotationType = rotationType;

            Log.Write("Rotation type: " + rotationType);

            WoW.Speak(rotationType.ToString());

            if (ConfigFile.PlayErrorSounds)
            {
                SystemSounds.Beep.Play();
            }

            Overlay.updateLabels();
        }
Пример #6
0
        private double getRotationValue(RotationType typeR)
        {
            string text = range[0, 32].Text;

            if (typeR == RotationType.Y)
            {
                text = range[0, 33].Text;
            }
            else if (typeR == RotationType.Z)
            {
                text = range[0, 34].Text;
            }

            if (string.IsNullOrEmpty(text.Trim()))
            {
                //this.writeError("未填写,默认为0", "板件绕" + typeR.ToString() + "旋转角度");
                return(0);
            }

            return(GetDoubleValue(text, "板件绕" + typeR.ToString() + "旋转角度", false, errors));
        }
Пример #7
0
        /// <summary>
        /// Post the players score to the given social leaderboard.
        /// Pass leaderboard config data to dynamically create if necessary.
        /// You can optionally send a user-defined json string of data
        /// with the posted score. This string could include information
        /// relevant to the posted score.
        /// </summary>
        /// <remarks>
        /// Service Name - leaderboard
        /// Service Operation - PostScoreDynamic
        /// </remarks>
        /// <param name="leaderboardId">
        /// The leaderboard to post to
        /// </param>
        /// <param name="score">
        /// The score to post
        /// </param>
        /// <param name="data">
        /// Optional user-defined data to post with the score
        /// </param>
        /// <param name="leaderboardType">
        /// leaderboard type
        /// </param>
        /// <param name="rotationType">
        /// Type of rotation
        /// </param>
        /// <param name="rotationReset">
        /// Date to reset the leaderboard UTC
        /// </param>
        /// <param name="retainedCount">
        /// How many rotations to keep
        /// </param>
        /// <param name="success">
        /// The success callback.
        /// </param>
        /// <param name="failure">
        /// The failure callback.
        /// </param>
        /// <param name="cbObject">
        /// The user object sent to the callback.
        /// </param>
        public void PostScoreToDynamicLeaderboard(
            string leaderboardId,
            long score,
            string jsonData,
            SocialLeaderboardType leaderboardType,
            RotationType rotationType,
            DateTime?rotationReset,
            int retainedCount,
            SuccessCallback success = null,
            FailureCallback failure = null,
            object cbObject         = null)
        {
            var data = new Dictionary <string, object>();

            data[OperationParam.SocialLeaderboardServiceLeaderboardId.Value] = leaderboardId;
            data[OperationParam.SocialLeaderboardServiceScore.Value]         = score;
            if (Util.IsOptionalParameterValid(jsonData))
            {
                var customData = JsonReader.Deserialize <Dictionary <string, object> >(jsonData);
                data[OperationParam.SocialLeaderboardServiceData.Value] = customData;
            }
            data[OperationParam.SocialLeaderboardServiceLeaderboardType.Value] = leaderboardType.ToString();
            data[OperationParam.SocialLeaderboardServiceRotationType.Value]    = rotationType.ToString();

            if (rotationReset.HasValue)
            {
                data[OperationParam.SocialLeaderboardServiceRotationResetTime.Value] = Util.DateTimeToUnixTimestamp(rotationReset.Value);
            }

            data[OperationParam.SocialLeaderboardServiceRetainedCount.Value] = retainedCount;

            var callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            var sc       = new ServerCall(ServiceName.Leaderboard, ServiceOperation.PostScoreDynamic, data, callback);

            _client.SendRequest(sc);
        }
        /// <summary>
        /// Post the players score to the given social leaderboard.
        /// Pass leaderboard config data to dynamically create if necessary.
        /// You can optionally send a user-defined json string of data
        /// with the posted score. This string could include information
        /// relevant to the posted score.
        /// </summary>
        /// <remarks>
        /// Service Name - SocialLeaderboard
        /// Service Operation - PostScoreDynamic
        /// </remarks>
        /// <param name="in_leaderboardId">
        /// The leaderboard to post to
        /// </param>
        /// <param name="in_score">
        /// The score to post
        /// </param>
        /// <param name="in_data">
        /// Optional user-defined data to post with the score
        /// </param>
        /// <param name="in_leaderboardType">
        /// leaderboard type
        /// </param>
        /// <param name="in_rotationType">
        /// Type of rotation
        /// </param>
        /// <param name="in_rotationReset">
        /// Date to reset the leaderboard
        /// </param>
        /// <param name="in_retainedCount">
        /// Hpw many rotations to keep
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status":200,
        ///   "data":{
        ///   }
        /// }
        /// </returns>
        public void PostScoreToDynamicLeaderboard(
            string in_leaderboardId,
            long in_score,
            string in_jsonData,
            SocialLeaderboardType in_leaderboardType,
            RotationType in_rotationType,
            DateTime? in_rotationReset,
            int in_retainedCount,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.SocialLeaderboardServiceLeaderboardId.Value] = in_leaderboardId;
            data[OperationParam.SocialLeaderboardServiceScore.Value] = in_score;
            if (Util.IsOptionalParameterValid(in_jsonData))
            {
                Dictionary<string, object> customData = JsonReader.Deserialize<Dictionary<string, object>>(in_jsonData);
                data[OperationParam.SocialLeaderboardServiceData.Value] = customData;
            }
            data[OperationParam.SocialLeaderboardServiceLeaderboardType.Value] = in_leaderboardType.ToString();
            data[OperationParam.SocialLeaderboardServiceRotationType.Value] = in_rotationType.ToString();

            if (in_rotationReset.HasValue)
                data[OperationParam.SocialLeaderboardServiceRotationReset.Value] = in_rotationReset.Value.ToString("d-MM-yyyy HH:mm");

            data[OperationParam.SocialLeaderboardServiceRetainedCount.Value] = in_retainedCount;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.SocialLeaderboard, ServiceOperation.PostScoreDynamic, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }