public void OnTry()
    {
        Team t = game.Ball.Owner.Team;

        t.fixUnits = t.opponent.fixUnits = true;
        if (t.Player != null)
        {
            t.Player.stopMove();
        }
        if (t.opponent.Player != null)
        {
            t.opponent.Player.stopMove();
        }


        t.nbPoints += game.settings.Global.Game.points_essai;
        Team opponent = game.Ball.Owner.Team.opponent;

        //super for try
        IncreaseSuper(game.settings.Global.Super.tryWinSuperPoints, t);
        IncreaseSuper(game.settings.Global.Super.tryLooseSuperPoints, opponent);

        TransformationManager tm = this.game.refs.managers.conversion;

        tm.ball  = game.Ball;
        tm.gamer = t.Player;

        //Debug.Log("Fire Event");
        tm.OnLaunch = this.game.OnConversionShot;

        // After the transformation is done, according to the result :
        tm.CallBack = delegate(TransformationManager.Result transformed)
        {
            if (transformed == TransformationManager.Result.TRANSFORMED)
            {
                //transfo super
                IncreaseSuper(game.settings.Global.Super.conversionWinSuperPoints, t);
            }
            else
            {
                //transfo super
                IncreaseSuper(game.settings.Global.Super.conversionLooseSuperPoints, t);
            }

            IncreaseSuper(game.settings.Global.Super.conversionOpponentSuperPoints, t.opponent);

            //if (game.settings.GameStates.MainState.PlayingState.GameActionState.ConvertingState.TransfoRemiseAuCentre || transformed != TransformationManager.Result.GROUND)
            //{
            UnitToGiveBallTo = opponent[3];
            //  this.StartPlacement();
            //}

            //this.game.OnResumeSignal(FreezeAfterConversion);
        };

        PlaceTransfoPlaceholders();
        UnitToGiveBallTo = opponent[3];
    }
    public void SetUp()
    {
        go                   = new GameObject();
        transManager         = go.AddComponent <TransformationManager>();
        minSize              = new Vector3(0.1f, 0.1f, 0.1f);
        maxSize              = new Vector3(2, 2, 2);
        transManager.minSize = minSize;
        transManager.maxSize = maxSize;

        go.transform.localScale = new Vector3(1, 1, 1);
    }
Example #3
0
        private string GetProcessedItem(ISubstitutionContext context, string input, MessageFieldType itemType)
        {
            Logger.WriteTrace(string.Format("{0} processing ", itemType), SeverityEnum.Trace);
            var worker         = SubstitutionManager.GetWorker(context, itemType);
            var res            = worker.PreProcess(input, context);
            var transformation = TransformationManager.GetTransformation(itemType, context);

            res = transformation.Transform(input, context, worker.OnPartLoaded);
            res = worker.PostProcess(input, context);
            Logger.WriteTrace(string.Format("{0} result: {1}", itemType, res), SeverityEnum.Trace);
            return(res);
        }
Example #4
0
 /// <summary>
 /// Get the necessary components: the collider of the bounding box and its annotationManager
 /// </summary>
 public void Start()
 {
     coll = GetComponent <BoxCollider>();
     attachementManager = gameObject.GetComponentInChildren <AttachementManager>();
     x3dParent          = transform.Find("Content/X3D Parent");
     if (x3dParent != null)
     {
         objectInfo = x3dParent.GetComponent <ObjectInfo>();
     }
     tapToPlace            = GetComponent <CustomTapToPlace>();
     transformationManager = GetComponent <TransformationManager>();
     info = GetComponent <BoundingBoxInfo>();
 }
Example #5
0
        /// <summary>
        /// Transforms to temporary file.
        /// </summary>
        /// <param name="transformationFileName">Name of the transofrmation file.</param>
        /// <param name="transformationFilePattern">The transformation file pattern.</param>
        /// <param name="transformationFileSourceMatchIndex">Index of the tranformation file source match.</param>
        /// <returns>Name of the source and transformed file if there was no error, otherwise null</returns>
        public static Tuple <string, string> TransformToTemporaryFile(string transformationFileName, string transformationFilePattern, int transformationFileSourceMatchIndex)
        {
            string sourceFileName;

            var result = CheckTransformationFileAndGetSourceFileFromIt(transformationFileName, transformationFilePattern,
                                                                       transformationFileSourceMatchIndex, out sourceFileName);

            if (!result)
            {
                Logger.LogInfo(Resources.InvalidTransformationFileName);
                return(null);
            }

            var tempTargetFileName = GetTemporaryFileFullName(TransformationTempFileName);

            try
            {
                DeleteFile(tempTargetFileName);
                Logger.LogInfo(string.Format(Resources.DeletionOfTemporaryFileDone, tempTargetFileName));


                result = TransformationManager.Transform(sourceFileName, transformationFileName, tempTargetFileName, new TransformationLogger());

                if (result)
                {
                    Logger.LogInfo(string.Format(Resources.TransformationOfFileSuccessfullyDone, sourceFileName,
                                                 transformationFileName, tempTargetFileName));

                    FormatFile(tempTargetFileName);

                    return(new Tuple <string, string>(sourceFileName, tempTargetFileName));
                }

                //else error
                Logger.LogInfo(string.Format(Resources.TransformationProcessError, sourceFileName, transformationFileName,
                                             tempTargetFileName));

                return(null);
            }
            catch (Exception ex)
            {
                Logger.LogError(string.Format(Resources.ErrorWhileTransformingFile, sourceFileName, transformationFileName, tempTargetFileName));
                Logger.LogError(ex);
            }

            return(null);
        }
Example #6
0
        /// <summary>
        /// Transforms the specified transofrmation file name.
        /// </summary>
        /// <param name="transformationFileName">Name of the transofrmation file.</param>
        /// <param name="transformationFilePattern">The transformation file pattern.</param>
        /// <param name="transformationFileSourceMatchIndex">Index of the tranformation file source match.</param>
        public static void Transform(string transformationFileName, string transformationFilePattern, int transformationFileSourceMatchIndex)
        {
            string sourceFileName;

            var result = CheckTransformationFileAndGetSourceFileFromIt(transformationFileName, transformationFilePattern,
                                                                       transformationFileSourceMatchIndex, out sourceFileName);

            if (!result)
            {
                Logger.LogInfo(Resources.InvalidTransformationFileName);
                return;
            }

            if (IsFileReadOnly(sourceFileName))
            {
                Logger.LogInfo(string.Format(Resources.FileIsReadOnly, sourceFileName));
                MessageBox.Show(string.Format(Resources.FileIsReadOnlyChange, sourceFileName), Resources.ApplicationCaption, MessageBoxButton.OK, MessageBoxImage.Asterisk);
                return;
            }

            var backupFileName = GetBackupFileNameOfFile(sourceFileName);

            try
            {
                DeleteFile(backupFileName);
                Logger.LogInfo(string.Format(Resources.DeletionOfTemporaryFileDone, backupFileName));

                CreateBackupFileOfFile(sourceFileName, backupFileName);
                Logger.LogInfo(string.Format(Resources.CopyOfSourceFileDone, sourceFileName, backupFileName));

                result = TransformationManager.Transform(backupFileName, transformationFileName, sourceFileName, new TransformationLogger());
                Logger.LogInfo(result
                    ? string.Format(Resources.TransformationOfFileSuccessfullyDone, backupFileName,
                                    transformationFileName, sourceFileName)
                    : string.Format(Resources.TransformationProcessError, backupFileName, transformationFileName,
                                    sourceFileName));

                FormatFile(sourceFileName);
                DeleteFile(backupFileName);
                Logger.LogInfo(string.Format(Resources.DeletionOfTemporaryFileDone, backupFileName));
            }
            catch (Exception ex)
            {
                Logger.LogError(string.Format(Resources.ErrorWhileTransformingFile, backupFileName, transformationFileName, sourceFileName));
                Logger.LogError(ex);
            }
        }
 public TransformationsViewModel(Action animFinished)
 {
     animationFinished = animFinished;
     Exit                = new Command(PerformExit);
     Transform           = new Command(PerformAnimation);
     StopTransform       = new Command(PerformStop);
     PauseTransform      = new Command(PerformPause);
     _CoordX             = 0;
     _CoordY             = 0;
     _SideLength         = 1;
     _MaxRotation        = 90;
     _RotateAroundCenter = true;
     _PivotVertex        = 1;
     transformer         = new TransformationManager(_CoordX, _CoordY, _SideLength)
     {
         RotateAroundCenter = _RotateAroundCenter,
         MaxRotation        = _MaxRotation,
         VertexIndex        = _PivotVertex
     };
 }
 /// <summary>
 /// Gets the necessary components: the transformationManager and  the inputManager
 /// </summary>
 void Start()
 {
     transformationManager = toManipulate.GetComponent <TransformationManager>();
 }
    public void EnableTransformation()
    {
        TransformationManager tm = this.game.refs.managers.conversion;

        tm.enabled = true;
    }