public ScenarioInput6()
        {
            this.InitializeComponent();

            photoSize  = PhotoSize.psFullPage;
            photoScale = Scaling.sShrinkToFit;
        }
Example #2
0
File: HUD.cs Project: lunice/bgo
    public void playAnimNeedMore(VisualValuesType typeT)
    {
        PushDownButton target  = null;
        DigitsLabel    targetD = null;
        MAIN           main    = MAIN.getMain;

        switch (typeT)
        {
        case VisualValuesType.VVT_MONEY: { target = moneyBtn; targetD = main.money; } break;

        case VisualValuesType.VVT_RUBINS: { target = rubinsBtn; targetD = main.rubins; } break;

        case VisualValuesType.VVT_XP: { target = expBtn; /* EXP! */ } break;

        default: { if (MAIN.IS_TEST)
                   {
                       Errors.show("Неизвестный тип отображаемых значений HUD-a:" + typeT);
                   }
        } return;
        }
        SoundsSystem.play(Sound.S_NEED_MORE_FUNDS);
        if (target.GetComponent <Scaling>() != null)
        {
            return;
        }
        Utils.increaseOrder(target.transform, changeOrderValueForNeedMoreButton);
        var scalingAnim = Scaling.set(target.gameObject, 1.3f, 1.5f, 1);

        scalingAnim.subscribeOnScalingFinish(onNeedMoreScalingAnim);
        ChangeColor.set(targetD.transform, new Color(1.0f, 0.0f, 0.0f, 1.0f), 0.25f, true, 6);
        _isPlaingAnim = true;
    }
Example #3
0
        public override void Train(IForecastingDataSets datasets)
        {
            Parameter svmpara = mParameter as Parameter;

            OnStartRunning(new ComponentRunEventArgs(datasets));
            double[] yvalue   = null;
            int      maxIndex = 0;

            Node[][] nodes   = CreateNodes(datasets, out yvalue, out maxIndex);
            Problem  problem = new Problem(nodes.Length, yvalue, nodes, maxIndex);

            mRange  = Scaling.DetermineRange(problem);
            problem = Scaling.Scale(mRange, problem);

            TrainedModel            = Training.Train(problem, svmpara as Parameter);
            datasets.ForecastedData = new double[datasets.InputData.Length][];

            for (int i = 0; i < datasets.InputData.Length; i++)
            {
                datasets.ForecastedData[i]    = new double[1];
                datasets.ForecastedData[i][0] = Forecast(datasets.InputData[i]);
                OnRunningEpoch(new ComponentRunEpochEventArgs(i));
            }

            svmpara.Count      = TrainedModel.SupportVectorCount;
            svmpara.Percentage = TrainedModel.SupportVectorCount / (double)problem.Count;

            OnFinishRunning(new ComponentRunEventArgs(datasets));
        }
 private void RaiseScaling(SpaceTime.Scale scale, float value)
 {
     if (Scaling != null)
     {
         Scaling.Invoke(scale, value);
     }
 }
Example #5
0
        private async Task OnResumeProcessesAsync(Scaling scaling)
        {
            var resumeProcessesRequest = GetProcessesRequest <ResumeProcessesRequest>(scaling);

            using var client = GetClient();
            await client.ResumeProcessesAsync(resumeProcessesRequest);
        }
Example #6
0
        private async Task OnSuspendProcessesAsync(Scaling scaling)
        {
            var suspendProcessesRequest = GetProcessesRequest <SuspendProcessesRequest>(scaling);

            using var client = GetClient();
            await client.SuspendProcessesAsync(suspendProcessesRequest);
        }
        public static DisplayConfigScaling ToDisplayConfigScaling(this Scaling scaling)
        {
            switch (scaling)
            {
            case Scaling.Identity:

                return(DisplayConfigScaling.Identity);

            case Scaling.Centered:

                return(DisplayConfigScaling.Centered);

            case Scaling.Stretched:

                return(DisplayConfigScaling.Stretched);

            case Scaling.AspectRatioCenteredMax:

                return(DisplayConfigScaling.AspectRatioCenteredMax);

            case Scaling.Custom:

                return(DisplayConfigScaling.Custom);

            case Scaling.Preferred:

                return(DisplayConfigScaling.Preferred);

            default:

                return(DisplayConfigScaling.NotSpecified);
            }
        }
Example #8
0
        /// <summary>
        ///     Creates a new PathAdvancedTargetInfo for TVs
        /// </summary>
        /// <param name="rotation">Screen rotation</param>
        /// <param name="scale">Screen scaling</param>
        /// <param name="tvFormat">The TV format to apply</param>
        /// <param name="connectorType">Specify connector type. For TV only</param>
        /// <param name="refreshRateInMillihertz">Screen refresh rate</param>
        /// <param name="timingOverride">Timing override</param>
        /// <param name="isInterlaced">Indicates if the mode is interlaced</param>
        /// <param name="isClonePrimary">Indicates if the display is the primary display of a clone topology</param>
        /// <param name="isClonePanAndScanTarget">Indicates if the target Pan and Scan is enabled</param>
        /// <param name="disableVirtualModeSupport"></param>
        /// <param name="isPreferredUnscaledTarget"></param>
        /// <exception cref="NVIDIANotSupportedException"></exception>
        public PathAdvancedTargetInfo(
            Rotate rotation,
            Scaling scale,
            TVFormat tvFormat,
            ConnectorType connectorType,
            uint refreshRateInMillihertz   = 0,
            TimingOverride timingOverride  = TimingOverride.Current,
            bool isInterlaced              = false,
            bool isClonePrimary            = false,
            bool isClonePanAndScanTarget   = false,
            bool disableVirtualModeSupport = false,
            bool isPreferredUnscaledTarget = false)
            : this(
                rotation, scale, refreshRateInMillihertz, timingOverride, isInterlaced, isClonePrimary,
                isClonePanAndScanTarget,
                disableVirtualModeSupport, isPreferredUnscaledTarget)
        {
            if (tvFormat == TVFormat.None)
            {
                throw new NVIDIANotSupportedException(
                          "This overload is for TV displays, use the other overload(s) if the display is not a TV.");
            }

            this           = typeof(PathAdvancedTargetInfo).Instantiate <PathAdvancedTargetInfo>();
            _TVFormat      = tvFormat;
            _ConnectorType = connectorType;
        }
Example #9
0
        /// <summary>
        ///     Creates a new PathAdvancedTargetInfo for monitors
        /// </summary>
        /// <param name="rotation">Screen rotation</param>
        /// <param name="scale">Screen scaling</param>
        /// <param name="refreshRateInMillihertz">Screen refresh rate</param>
        /// <param name="timingOverride">Timing override</param>
        /// <param name="isInterlaced">Indicates if the mode is interlaced</param>
        /// <param name="isClonePrimary">Indicates if the display is the primary display of a clone topology</param>
        /// <param name="isClonePanAndScanTarget">Indicates if the target Pan and Scan is enabled</param>
        /// <param name="disableVirtualModeSupport"></param>
        /// <param name="isPreferredUnscaledTarget"></param>
        /// <exception cref="NVIDIANotSupportedException"></exception>
        public PathAdvancedTargetInfo(
            Rotate rotation,
            Scaling scale,
            uint refreshRateInMillihertz   = 0,
            TimingOverride timingOverride  = TimingOverride.Current,
            bool isInterlaced              = false,
            bool isClonePrimary            = false,
            bool isClonePanAndScanTarget   = false,
            bool disableVirtualModeSupport = false,
            bool isPreferredUnscaledTarget = false)
        {
            if (timingOverride == TimingOverride.Custom)
            {
                throw new NVIDIANotSupportedException("Custom timing is not supported yet.");
            }

            this      = typeof(PathAdvancedTargetInfo).Instantiate <PathAdvancedTargetInfo>();
            _Rotation = rotation;
            _Scaling  = scale;
            _RefreshRateInMillihertz  = refreshRateInMillihertz;
            _TimingOverride           = timingOverride;
            IsInterlaced              = isInterlaced;
            IsClonePrimary            = isClonePrimary;
            IsClonePanAndScanTarget   = isClonePanAndScanTarget;
            DisableVirtualModeSupport = disableVirtualModeSupport;
            IsPreferredUnscaledTarget = isPreferredUnscaledTarget;
        }
Example #10
0
		public Image( IDrawable drawable, Scaling scaling = Scaling.Stretch, int align = AlignInternal.center )
		{
			setDrawable( drawable );
			_scaling = scaling;
			_align = align;
			setSize( preferredWidth, preferredHeight );
			touchable = Touchable.Disabled;
		}
        //TODO - write a version of your scaling app to implement crdt's
        //first write to a static list from multiple threads and have the results come out as expected
        //http://www.se-radio.net/2016/03/se-radio-episode-252-christopher-meiklejohn-on-crdts/
        private static void Run()
        {
            Scaling scaling = new Scaling();

            scaling.RunScaling();

            Console.Read();    //wait for developer to close application :)
        }
Example #12
0
 public Image(IDrawable drawable, Scaling scaling = Scaling.Stretch, int align = AlignInternal.Center)
 {
     SetDrawable(drawable);
     _scaling = scaling;
     _align   = align;
     SetSize(PreferredWidth, PreferredHeight);
     touchable = Touchable.Disabled;
 }
Example #13
0
 /// <summary>
 /// Retrieves and updates current window measurements to re-scale live
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
 {
     bounds = ApplicationView.GetForCurrentView().VisibleBounds;
     Scaling.SetScale();//Whenever window size changes update scaling size
     //Update origin (centerX and centerY) after a window change
     centerX = (float)bounds.Width / 2;
     centerY = (float)bounds.Height / 2;
 }
Example #14
0
        private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
        {
            bounds = ApplicationView.GetForCurrentView().VisibleBounds;
            Scaling.SetScale();

            photonX = (float)bounds.Width / 2;
            photonY = (float)bounds.Height;
        }
        /// <summary>
        /// This is the event handler for PrintManager.PrintTaskRequested.
        /// In order to ensure a good user experience, the system requires that the app handle the PrintTaskRequested event within the time specified
        /// by PrintTaskRequestedEventArgs->Request->Deadline.
        /// Therefore, we use this handler to only create the print task.
        /// The print settings customization can be done when the print document source is requested.
        /// </summary>
        /// <param name="sender">The print manager for which a print task request was made.</param>
        /// <param name="e">The print taks request associated arguments.</param>
        protected override void PrintTaskRequested(Windows.Graphics.Printing.PrintManager sender, Windows.Graphics.Printing.PrintTaskRequestedEventArgs e)
        {
            PrintTask printTask = null;

            printTask = e.Request.CreatePrintTask("Printing Coloring Page", sourceRequestedArgs =>
            {
                PrintTaskOptionDetails printDetailedOptions = PrintTaskOptionDetails.GetFromPrintTaskOptions(printTask.Options);

                // Choose the printer options to be shown.
                // The order in which the options are appended determines the order in which they appear in the UI
                printDetailedOptions.DisplayedOptions.Clear();
                printDetailedOptions.DisplayedOptions.Add(Windows.Graphics.Printing.StandardPrintTaskOptions.MediaSize);
                printDetailedOptions.DisplayedOptions.Add(Windows.Graphics.Printing.StandardPrintTaskOptions.Copies);

                // Create a new list option.
                PrintCustomItemListOptionDetails photoSize = printDetailedOptions.CreateItemListOption("photoSize", "Photo Size");
                photoSize.AddItem("SizeFullPage", "Full Page");
                photoSize.AddItem("Size4x6", "4 x 6 in");
                photoSize.AddItem("Size5x7", "5 x 7 in");
                photoSize.AddItem("Size8x10", "8 x 10 in");

                // Add the custom option to the option list.
                printDetailedOptions.DisplayedOptions.Add("photoSize");

                PrintCustomItemListOptionDetails scaling = printDetailedOptions.CreateItemListOption("scaling", "Scaling");
                scaling.AddItem("ShrinkToFit", "Shrink To Fit");
                scaling.AddItem("Crop", "Crop");

                // Add the custom option to the option list.
                printDetailedOptions.DisplayedOptions.Add("scaling");

                // Set default orientation to landscape.
                printTask.Options.Orientation = PrintOrientation.Landscape;

                // Register for print task option changed notifications.
                printDetailedOptions.OptionChanged += PrintDetailedOptionsOptionChanged;

                // Register for print task Completed notification.
                // Print Task event handler is invoked when the print job is completed.
                printTask.Completed += async(s, args) =>
                {
                    await scenarioPage.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        ClearPageCollection();

                        // Reset image options to default values.
                        this.photoScale = Scaling.ShrinkToFit;
                        this.photoSize  = PhotoSize.SizeFullPage;

                        // Reset the current page description
                        currentPageDescription = null;
                    });
                };

                // Set the document source.
                sourceRequestedArgs.SetSource(printDocumentSource);
            });
        }
Example #16
0
        private static void Main()
        {
            try
            {
                Log.Initialize();
                SingleAppInstance.Initialize();
                Translator.Initialize();

                Config.UpgradeIfNotUpgraded();
                if (Config.LoadOrSetByUser())
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.ThreadException += ThreadException;
                    void ThreadException(object s, ThreadExceptionEventArgs t)
                    {
                        AskUserSendError(t.Exception);
                    }

                    Scaling.Initialize();
                    FolderOptions.Initialize();

                    using (new App())
                    {
                        Log.WriteApplicationRuns();
                        Application.Run();
                    }
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
#pragma warning restore CA1031 // => Represents ThreadException during attached to process
            {
                AskUserSendError(ex);
            }
            finally
            {
                Log.Close();
            }

            void AskUserSendError(Exception ex)
            {
                Log.Error("Application Crashed", ex);

#warning [Feature] When Error ask user to send us #47, todo own dialog, lines here too long
                if (MessageBox.Show("A problem has been encountered and the application needs to restart. " +
                                    "Reporting this error will help us make our product better. Press yes to open your standard email app.",
                                    "SystemTrayMenu BugSplat", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Log.ProcessStart("mailto:" + "*****@*****.**" +
                                     "?subject=SystemTrayMenu Bug reported " +
                                     Assembly.GetEntryAssembly().GetName().Version +
                                     "&body=" + ex.ToString());
                }

                AppRestart.ByThreadException();
            }
        }
Example #17
0
        private dynamic GetProcessesRequest <T>(Scaling scaling)
            where T : AmazonAutoScalingRequest, new()
        {
            dynamic request = new T();

            request.AutoScalingGroupName = scaling.Group.AutoScalingGroupName;
            request.ScalingProcesses     = scaling.Processes ?? _processService.GetProcessesName();
            return(request);
        }
Example #18
0
        public Image(ISceneDrawable drawable, Scaling scaling, Alignment align)
        {
            Drawable = drawable;
            Scaling  = scaling;
            Align    = align;

            Width  = PrefWidth;
            Height = PrefHeight;
        }
Example #19
0
        public Image(ISceneDrawable drawable, Scaling scaling, Alignment align)
        {
            Drawable = drawable;
            Scaling = scaling;
            Align = align;

            Width = PrefWidth;
            Height = PrefHeight;
        }
Example #20
0
 private void Awake()
 {
     this.mTrans = base.transform;
     mRoots.Add(this);
     if (this.automatic)
     {
         this.scalingStyle = Scaling.PixelPerfect;
         this.automatic    = false;
     }
 }
Example #21
0
        public async Task ResumeProcessesAsync(Scaling scaling)
        {
            await SetScalingGroupAsync(scaling);

            if (scaling.Group is null)
            {
                return;
            }
            await OnResumeProcessesAsync(scaling);
        }
Example #22
0
 private void Awake()
 {
     mTrans = transform;
     mRoots.Add(this);
     if (automatic)
     {
         scalingStyle = Scaling.PixelPerfect;
         automatic    = false;
     }
 }
        /// <summary>
        /// Applies changes to the data
        /// </summary>
        /// <param name="changeset">Set of data changes, either from an Undo or a Redo event</param>
        /// <param name="useUndoChangeSet">Indicates whether the Undo or the Redo Changeset should be used</param>
        private void ApplyChangeset(UndoRedo changeset, Activity activity)
        {
            _applyingChangeSet = true;
            bool   Undoing    = (activity == Activity.Undo);
            string Serialized = string.Empty;
            string ListString = string.Empty;

            _Document.SuppressEvents = true;

            #region [ Scaling ]

            Scaling Scaling = changeset.Scaling(Undoing);
            if (Scaling != null)
            {
                if (!Scaling.LatticeSize.IsEmpty)
                {
                    _Document.Scaling.LatticeSize = Scaling.LatticeSize;
                    //ChangedScaling = true;
                }

                if (Scaling.CellSize != null)
                {
                    _Document.Scaling.CellSize = Scaling.CellSize.GetValueOrDefault();
                    //ChangedScaling = true;
                }

                if (Scaling.ShowGridLines != null)
                {
                    _Document.Scaling.ShowGridLines = Scaling.ShowGridLines.GetValueOrDefault(true);
                    //ChangedScaling = true;
                }

                if (Scaling.Zoom != null)
                {
                    _Document.Scaling.Zoom = Scaling.Zoom.GetValueOrDefault();
                    //ChangedScaling = true;
                }
            }

            #endregion [ Scaling ]

            #region [ Clipboard ]

            bool ClipboardChanged = false;

            if (ClipboardChanged)
            {
                ClipboardController.Instance.DisplayDiagnosticData();
            }

            #endregion [ Clipboard ]

            _Document.SuppressEvents = false;
            _applyingChangeSet       = false;
        }
Example #24
0
 public void AntMan()
 {
     if (prevScale == null)
     {
         if (safe && Check())
         {
             safe          = false;
             currentTarget = controlPos.GetClosestTarget();
             aHouse.parent = currentTarget;
             scale         = currentTarget.gameObject.GetComponent <Scaling>();
             StartCoroutine(scale.Enlarge());
             boxColl.enabled = false;
             letters.enabled = false;
             animRoof.SetTrigger("RoofOff");
         }
         else if (!safe && !currentTarget.gameObject.GetComponent <Scaling>().isBig)
         {
             safe          = true;
             aHouse.parent = null;
             StartCoroutine(scale.Shrink());
             scale           = null;
             prevScale       = currentTarget.gameObject.GetComponent <Scaling>();
             currentTarget   = null;
             boxColl.enabled = true;
             letters.enabled = true;
             animRoof.SetTrigger("RoofIn");
         }
     }
     else
     {
         if (safe && Check() && prevScale.isBig)
         {
             safe          = false;
             currentTarget = controlPos.GetClosestTarget();
             aHouse.parent = currentTarget;
             scale         = currentTarget.gameObject.GetComponent <Scaling>();
             StartCoroutine(scale.Enlarge());
             boxColl.enabled = false;
             letters.enabled = false;
             animRoof.SetTrigger("RoofOff");
         }
         else if (!safe && !currentTarget.gameObject.GetComponent <Scaling>().isBig)
         {
             safe          = true;
             aHouse.parent = null;
             StartCoroutine(scale.Shrink());
             scale           = null;
             prevScale       = currentTarget.gameObject.GetComponent <Scaling>();
             currentTarget   = null;
             boxColl.enabled = true;
             letters.enabled = true;
             animRoof.SetTrigger("RoofIn");
         }
     }
 }
Example #25
0
    public static Scaling set(GameObject target, Vector3 value, float period, int limitCycles = -1)
    {
        Scaling scaling = target.AddComponent <Scaling>();

        //scaling.scalingValue = value;
        scaling.scalingPeriod      = period;
        scaling.scalingLimitCycles = limitCycles;
        scaling.defaultScale       = target.transform.localScale;
        scaling.difValue           = value - scaling.defaultScale;
        return(scaling);
    }
Example #26
0
        public override int GetHashCode()
        {
            var hashCode = 96768724;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(VideoFilename);

            hashCode = hashCode * -1521134295 + Scaling.GetHashCode();
            hashCode = hashCode * -1521134295 + Alignment.GetHashCode();
            hashCode = hashCode * -1521134295 + Loop.GetHashCode();
            return(hashCode);
        }
Example #27
0
 public Scaler(string scaling)
 {
     if (string.IsNullOrWhiteSpace(scaling))
         _scaling = Scaling.ZeroToMaxBound;
     else if (scaling.ToLower() == "u")
         _scaling = Scaling.Normalized;
     else if (scaling.ToLower() == "uu")
         _scaling = Scaling.DoubleNormalized;
     else
         throw new ArgumentException("unrecognized scaling "+scaling);
 }
Example #28
0
    void Awake()
    {
        mTrans = transform;
        mRoots.Add(this);

        // Backwards compatibility
        if (automatic)
        {
            scalingStyle = Scaling.PixelPerfect;
            automatic    = false;
        }
    }
Example #29
0
    /// <summary>
    /// Awake function of GameManager. Checks if another instance of this GameObject exists and
    /// if not, initializes all required atributes and values of the GameManager, creating a new
    /// one.
    ///
    /// If the GameManager already exists, destroy this gameObject.
    /// </summary>
    private void Awake()
    {
        // If GameManager is not created and initialized...
        if (_instance == null)
        {
            // Set this GameManager as instance
            _instance = this;

            // Set this gameObject to not Destroy when changing between scenes
            DontDestroyOnLoad(gameObject);

            _gc = LoadingFiles.ReadGameConfig();

            // Store canvas' scaling reference resolution
            _scalingReferenceResolution = _cnv.GetComponent <CanvasScaler>().referenceResolution;

            // Initialize Scaling with cam values and scalingreference values
            _scalator = new Scaling(new Vector2(Screen.width, Screen.height), _scalingReferenceResolution, (int)_cam.orthographicSize);

            // Search all panels for later calculation
            ReloadPanels();

            // Load all AssetBundles
            _lab = new LoadAssetBundle();

            // Depending on OS system, load from a different path and using different techniques
#if !UNITY_EDITOR && UNITY_ANDROID
            _lab.LoadBundlesAndroid(Application.streamingAssetsPath + "/AssetBundles/");
#else
            _lab.LoadBundlesWindows(Application.streamingAssetsPath + "/AssetBundles/");
#endif

            // Initialize random value
            _rnd = new Random();

            // Load gameInfo previously generated, data driven information
            _gi = LoadingFiles.ReadGameInfo();

            // Set all values of this information
            SetGameInfo();

            // Get Player information and store it
            _currentPlayerData = LoadingFiles.ReadPlayerData(_maxDifficulty);

            // Set the time waiting for challenge info
            SetTimeForChallenge();
        }
        else if (_instance != this)
        {
            Destroy(gameObject);
        }
    }
Example #30
0
 /// <summary>
 /// Initializing Scaling Components, Centers, and Timer Components (Tick Events & Tick Intervals)
 /// </summary>
 public MainPage()
 {
     this.InitializeComponent();
     Window.Current.SizeChanged += Current_SizeChanged; //Subsribing an window size change event
     Scaling.SetScale();                                //Set scale upon intialization
     //Set Center Coordinate after scaling
     centerX             = (float)bounds.Width / 2;
     centerY             = (float)bounds.Height / 2;
     roundTimer.Tick    += RoundTimer_Tick;
     roundTimer.Interval = new TimeSpan(0, 0, 1);
     enemyTimer.Tick    += EnemyTimer_Tick;
     enemyTimer.Interval = new TimeSpan(0, 0, 0, 0, enemyGenRand.Next(300, 3005 - (int)myLevel * 5));//enemy attack time between 300ms a level-varying time for increased frequency the futher you go
 }
 private void scalling_Click(object sender, EventArgs e)
 {
     if (coordinate.Count > 0)
     {
         var    newCoordinates = Scaling.Scale(int.Parse(TSX.Text), int.Parse(TSY.Text), coordinate);
         Bitmap bmp            = new Bitmap(pictureBox1.Image);
         foreach (var item in newCoordinates)
         {
             bmp.SetPixel(pictureBox1.Size.Width / 2 + item.X, (bmp.Size.Height / 2 - item.Y), Color.Red);
         }
         pictureBox1.Image = bmp;
     }
 }
        public static string ChangeValue(this Scaling scaling, string value, byte[] byteValue, Direction direction, ChangeType changeType)
        {
            var changeDirection = direction == Direction.Increment ? 1 : -1;

            if (scaling.StorageType == StorageType.bloblist)
            {
                return(GetNextBloblistItem(scaling.Data, value, changeDirection));
            }

            var updatedValue = CalcNextValue(value, scaling.Inc, changeDirection, byteValue, scaling, changeType);

            return(updatedValue);
        }
Example #33
0
    // Калбэк приходящий непосредственно от самих шаров, при их столкновении с другими шарами, порождает звёзды, а сам шар переводит в состояние "остановлен"
    public void onNewBallStop(Ball newBall)
    {
        main.receivingTray.setBallToStopingBalls(newBall.gameObject);
        Ticket[] tickets = main.ticketHolder.getTickets();
        var      rbB     = newBall.GetComponent <Rigidbody2D>();

        for (int i = 0; (i < main.ticketHolder.transform.childCount && tickets[i] != null); i++)
        {
            TicketCell tC = tickets[i].getCellByNum(newBall.number);
            if (tC)
            {
                GameObject flyBall;
                if (flyingBallsPrefab != null && flyingBallsPrefab.GetComponent <SpriteRenderer>().sprite != null)
                {
                    flyBall = Instantiate(flyingBallsPrefab);
                }
                else
                {
                    flyBall = Instantiate(newBall.gameObject);
                }
                flyBall.transform.parent = flingBalls;
                Flying f = flyBall.AddComponent <Flying>();
                f.destroyOnArrive = false;
                f.slowdown(3.0f, 0.02f, 0.9f); // #V здесь торможение звёзд: 1 - дистанция с которой начинается торможение, 2 - до скорости, 3 - сила торможения(если 1 то нулевая сила, если 0 то мгновеная остановка, если больше одного наоборот ускорение)
                flyBall.transform.position = newBall.transform.position;
                var b = flyBall.GetComponent <Ball>();
                if (b != null)
                {
                    flyBall.name = "flingBall_" + b.number;
                    b.setOrderLayer(9);
                }
                var circleCollider = flyBall.GetComponent <CircleCollider2D>();
                if (circleCollider != null)
                {
                    circleCollider.enabled = false;
                }
                var rb = flyBall.GetComponent <Rigidbody2D>();
                if (rb != null)
                {
                    Destroy(rb);
                }
                var rotating = Rotating.set(flyBall, rbB.angularVelocity);
                rotating.slowdown(0.1f, 0.96f); // #V замедление вращение звёздочек
                f.init(tC.transform.position, 0.02f, newBall.prevVelocity[0] * 0.005f);
                f.subscribe(onBallArrive, tC.gameObject, newBall.gameObject);
                // #V эффекты на звёздочках:
                Flickering.set(flyBall, 0.15f);
                Scaling.set(flyBall, 0.5f, 0.15f);
            }
        }
    }
 public static Color32[] GetColors( Scaling.SColor[] _colors)
 {
     Color32[] outArray = new Color32[_colors.Length];
     for(int i = 0;i< _colors.Length;i++)
     {
         outArray[i] = new Color32(
             (byte)(_colors[i].r * 255),
             (byte)(_colors[i].g * 255),
             (byte)(_colors[i].b * 255),
             (byte)(_colors[i].a * 255)
             );
     }
     return outArray;
 }
Example #35
0
 public Scaler( string scaling )
 {
     if ( string.IsNullOrWhiteSpace( scaling ) )
         _scaling = Scaling.ZeroToMaxBound;
     else switch (scaling.ToLower())
     {
         case "u":
             _scaling = Scaling.Normalized;
             break;
         case "uu":
             _scaling = Scaling.DoubleNormalized;
             break;
         default:
             throw new ArgumentException( "unrecognized scaling " + scaling );
     }
 }
Example #36
0
		public Image( Texture2D texture, Scaling scaling = Scaling.Stretch, int align = AlignInternal.center ) : this( new Subtexture( texture ), scaling, align )
		{
		}
Example #37
0
    void Awake()
    {
        mTrans = transform;
        mRoots.Add(this);

        // Backwards compatibility
        if (automatic)
        {
            scalingStyle = Scaling.PixelPerfect;
            automatic = false;
        }

        _SH = activeHeight;
        _SW = (int)(Screen.width * ((float)activeHeight / (float)Screen.height));
    }
Example #38
0
 public ImageDrawer(Scaling.Scaler scaler)
 {
     _scaler = scaler;
 }
Example #39
0
    void Awake()
    {
        mTrans = transform;
        mRoots.Add(this);

        // Backwards compatibility
        if (automatic)
        {
            scalingStyle = Scaling.PixelPerfect;
            automatic = false;
        }
    }
Example #40
0
        private void ConstructPhysicsSimulator(Vector2 gravity)
        {
            geomList = new GeomList();
            geomAddList = new List<Geom>();
            geomRemoveList = new List<Geom>();

            bodyList = new BodyList();
            bodyAddList = new List<Body>();
            bodyRemoveList = new List<Body>();

            controllerList = new ControllerList();
            controllerAddList = new List<Controller>();
            controllerRemoveList = new List<Controller>();

            jointList = new JointList();
            jointAddList = new List<Joint>();
            jointRemoveList = new List<Joint>();

            springList = new SpringList();
            springAddList = new List<Spring>();
            springRemoveList = new List<Spring>();

            _broadPhaseCollider = new SelectiveSweepCollider(this);

            arbiterList = new ArbiterList();
            _gravity = gravity;

            arbiterPool = new Pool<Arbiter>(_arbiterPoolSize);

            #region Added by Daniel Pramel 08/17/08

            _inactivityController = new InactivityController(this);

            _scaling = new Scaling(0.001f, 0.01f);

            #endregion
        }
Example #41
0
		public Image setScaling( Scaling scaling )
		{
			_scaling = scaling;
			return this;
		}
Example #42
0
 public void With_Should_Set_Scaling_And_Set_Parent()
 {
     var actual = new Scaling("MyScaling");
     _sut.With(() => actual);
     Assert.AreEqual(actual,_sut.Scaling);
     Assert.AreEqual(_sut, actual.Parent);
     Assert.AreEqual("MyTab.MyScaling",actual.Id);
 }
Example #43
0
        public void SetConfig(
			bool triggerConversion = false, 
			InputMode? inputMode = null,
			Scaling? scaling = null,
			OperatingMode? operatingMode = null,
			DataRate? dataRate = null)
        {
            var config = configRegister;

            if (triggerConversion)
                config.SetBit1(15);

            if (scaling != null)
                config = config.SetBits(12, (ushort)scaling, 3);

            if (inputMode != null)
                config = config.SetBits(9, (ushort)inputMode.Value, 3);

            if (operatingMode != null)
                config = config.SetBits(8, (ushort)operatingMode.Value, 1);

            if (dataRate != null)
                config = config.SetBits(5, (ushort)dataRate.Value, 3);

            configRegister = config;
        }
Example #44
0
 public Image(ISceneDrawable drawable, Scaling scaling)
     : this(drawable, scaling, Alignment.Center)
 {
 }
Example #45
0
		public Image( Subtexture subtexture, Scaling scaling = Scaling.Stretch, int align = AlignInternal.center ) : this( new SubtextureDrawable( subtexture ), scaling, align )
		{
		}
 public void If_DefaultConstructor_Is_Called_A_DefaultValue_Should_Be_Passed()
 {
     _sut  = new Scaling();
     Assert.AreEqual("NotSet",_sut.Id);
 }
 public void Setup()
 {
     _sut = Scaling.Create("MyScaling");
 }