Exemplo n.º 1
0
 public void SaveState(StateHolder st)
 {
     st.Rectangle1_Enabled           = _Enabled;
     st.Rectangle1_Volume            = _Volume;
     st.Rectangle1_Envelope          = _Envelope;
     st.Rectangle1_Frequency         = _Frequency;
     st.Rectangle1_SampleCount       = _SampleCount;
     st.Rectangle1_RenderedLength    = _RenderedLength;
     st.Rectangle1_DutyCycle         = _DutyCycle;
     st.Rectangle1_FreqTimer         = _FreqTimer;
     st.Rectangle1_DecayCount        = _DecayCount;
     st.Rectangle1_DecayTimer        = _DecayTimer;
     st.Rectangle1_DecayDiable       = _DecayDiable;
     st.Rectangle1_DecayReset        = _DecayReset;
     st.Rectangle1_DecayLoopEnable   = _DecayLoopEnable;
     st.Rectangle1_LengthCount       = _LengthCount;
     st.Rectangle1_SweepShift        = _SweepShift;
     st.Rectangle1_SweepDirection    = _SweepDirection;
     st.Rectangle1_SweepRate         = _SweepRate;
     st.Rectangle1_SweepEnable       = _SweepEnable;
     st.Rectangle1_SweepCount        = _SweepCount;
     st.Rectangle1_SweepReset        = _SweepReset;
     st.Rectangle1_SweepForceSilence = _SweepForceSilence;
     st.Rectangle1DutyPercentage     = DutyPercentage;
     st.Rectangle1WaveStatus         = WaveStatus;
 }
Exemplo n.º 2
0
        //[DebuggerStepThrough]
        ////[DebuggerHidden]
        public object NewInstance(CompositeInstance compositeInstance, StateHolder stateHolder, UsesInstance uses)
        {
            var    injectionContext = new InjectionContext(compositeInstance, uses, stateHolder);
            object mixin            = this.injectedObjectBuilder.NewInstance(injectionContext);

            return(mixin);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Closes the transaction and releases unmanaged resources.
 /// </summary>
 private void Close()
 {
     lock (this)
     {
         _state = _state ?? new StateHolder((TransactionState)_txs.TxClose(this));
     }
 }
Exemplo n.º 4
0
 public void LoadState(StateHolder st)
 {
     _Enabled           = st.Rectangle1_Enabled;
     _Volume            = st.Rectangle1_Volume;
     _Envelope          = st.Rectangle1_Envelope;
     _Frequency         = st.Rectangle1_Frequency;
     _SampleCount       = st.Rectangle1_SampleCount;
     _RenderedLength    = st.Rectangle1_RenderedLength;
     _DutyCycle         = st.Rectangle1_DutyCycle;
     _FreqTimer         = st.Rectangle1_FreqTimer;
     _DecayCount        = st.Rectangle1_DecayCount;
     _DecayTimer        = st.Rectangle1_DecayTimer;
     _DecayDiable       = st.Rectangle1_DecayDiable;
     _DecayReset        = st.Rectangle1_DecayReset;
     _DecayLoopEnable   = st.Rectangle1_DecayLoopEnable;
     _LengthCount       = st.Rectangle1_LengthCount;
     _SweepShift        = st.Rectangle1_SweepShift;
     _SweepDirection    = st.Rectangle1_SweepDirection;
     _SweepRate         = st.Rectangle1_SweepRate;
     _SweepEnable       = st.Rectangle1_SweepEnable;
     _SweepCount        = st.Rectangle1_SweepCount;
     _SweepReset        = st.Rectangle1_SweepReset;
     _SweepForceSilence = st.Rectangle1_SweepForceSilence;
     DutyPercentage     = st.Rectangle1DutyPercentage;
     WaveStatus         = st.Rectangle1WaveStatus;
 }
Exemplo n.º 5
0
 private void Awake()
 {
     player         = FindObjectOfType <Player>();
     tilesContainer = FindObjectOfType <TilesContainer>();
     stateHolder    = FindObjectOfType <StateHolder>();
     diceUI         = FindObjectOfType <DiceUI>();
 }
Exemplo n.º 6
0
        public void StateHolder_Operator_1()
        {
            int value1 = 10;
            StateHolder <int> holder = value1;
            int value2 = holder;

            Assert.AreEqual(value1, value2);
        }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        stateHolder = GetComponent <StateHolder>();

        timer      = 0f;
        isLoading  = false;
        isShooting = false;
    }
 //[DebuggerStepThrough]
 ////[DebuggerHidden]
 protected AbstractCompositeInstance(AbstractCompositeModel compositeModel, ModuleInstance moduleInstance, object[] mixins, StateHolder state)
 {
     this.CompositeModel = compositeModel;
     this.ModuleInstance = moduleInstance;
     this.Mixins = mixins;
     this.State = state;
     this.Proxy = compositeModel.NewProxy(this);
 }
Exemplo n.º 9
0
 void Start()
 {
     this.WeaponLogic     = GetComponent <WeaponLogic>();
     this.mov             = GetComponent <MovimientoController>();
     this.totemController = GetComponent <Totem>();
     initLine();
     this.stateHolder = GameObject.FindGameObjectWithTag("GameController").GetComponent <StateHolder>();
 }
Exemplo n.º 10
0
        public CompositeInstance NewValueInstance(ModuleInstance moduleInstance, UsesInstance uses, StateHolder stateHolder)
        {
            object[] mixins = this.mixinsModel.NewMixinHolder();
            CompositeInstance compositeInstance = new ValueInstance(this, moduleInstance, mixins, stateHolder);

            ((MixinsModel)this.mixinsModel).NewMixins(compositeInstance, uses, stateHolder, mixins);

            return compositeInstance;
        }
Exemplo n.º 11
0
        public override bool Validate(ValidateCallback callback, StateHolder state)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            if (sourceLocationId <= 0)
            {
                if (!callback(Translator.GetString("Source location cannot be empty!"), ErrorSeverity.Error, (int)ErrorCodes.SourceLocationEmpty, state))
                {
                    return(false);
                }
            }

            if (BusinessDomain.LoggedUser.LockedLocationId > 0 && BusinessDomain.LoggedUser.LockedLocationId != sourceLocationId)
            {
                if (!callback(Translator.GetString("The source location cannot be used!"), ErrorSeverity.Error, (int)ErrorCodes.SourceLocationCannotBeUsed, state))
                {
                    return(false);
                }
            }

            string error;
            string warning;

            if (!BusinessDomain.CanUseLocationInOperation(OperationType, sourceLocationId, out error, out warning))
            {
                if (error != null && !callback(error, ErrorSeverity.Error, (int)ErrorCodes.SourceLocationCannotBeUsed, state))
                {
                    return(false);
                }

                if (warning != null && !callback(error, ErrorSeverity.Warning, (int)ErrorCodes.SourceLocationCannotBeUsed, state))
                {
                    return(false);
                }
            }

            if (targetLocationId <= 0)
            {
                if (!callback(Translator.GetString("Target location cannot be empty!"), ErrorSeverity.Error, (int)ErrorCodes.TargetLocationEmpty, state))
                {
                    return(false);
                }
            }

            if (details.Any(d => d.Quantity.IsZero()))
            {
                if (!callback(Translator.GetString("Details contain zero quantities!"), ErrorSeverity.Error, (int)ErrorCodes.TargetLocationEmpty, state))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 12
0
 // For mixins
 //[DebuggerStepThrough]
 ////[DebuggerHidden]
 public InjectionContext(CompositeInstance compositeInstance, UsesInstance uses, StateHolder state)
 {
     this.CompositeInstance = compositeInstance;
     this.ModuleInstance = compositeInstance.ModuleInstance;
     this.Uses = uses;
     this.State = state;
     this.Next = null;
     this.ProxyHandler = null;
 }
Exemplo n.º 13
0
 //[DebuggerStepThrough]
 ////[DebuggerHidden]
 public void NewMixins(CompositeInstance compositeInstance, UsesInstance uses, StateHolder stateHolder, object[] mixins)
 {
     int i = 0;
     foreach (MixinModel mixinModel in this.mixinModels)
     {
         object mixin = mixinModel.NewInstance(compositeInstance, stateHolder, uses);
         mixins[i++] = mixin;
     }
 }
Exemplo n.º 14
0
        protected override async ValueTask OnClosed(DisconnectedReason reason)
        {
            StateHolder state = _state !;
            await Task.WhenAll(state.Input.CloseAsync(), state.OutputPump.CloseAsync());

            await base.OnClosed(reason);

            _state = null;
        }
Exemplo n.º 15
0
        public void StateHolder_Event_2()
        {
            StateHolder <string> holder = new StateHolder <string>();
            bool flag = false;

            holder.ValueChanged += (sender, args) => { flag = true; };
            holder.Value         = "World";
            Assert.IsTrue(flag);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Rolls this tx back and closes it.
        /// </summary>
        public void Rollback()
        {
            lock (this)
            {
                ThrowIfClosed();

                _state = new StateHolder(_txs.TxRollback(this));
            }
        }
Exemplo n.º 17
0
        public void StateHolder_ToString_1()
        {
            StateHolder <string> holder = new StateHolder <string>();

            Assert.AreEqual("(null)", holder.ToString());

            holder = "Hello";
            Assert.AreEqual("Hello", holder.ToString());
        }
Exemplo n.º 18
0
        public void StateHolder_Value_1()
        {
            StateHolder <int> holder = 10;

            Assert.AreEqual(10, holder.Value);

            holder.Value = 100;
            Assert.AreEqual(100, holder.Value);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Commits this tx and closes it.
        /// </summary>
        public void Commit()
        {
            lock (this)
            {
                ThrowIfClosed();

                _state = new StateHolder(_txs.TxCommit(this));
            }
        }
Exemplo n.º 20
0
        public void StateHolder_Event_1()
        {
            StateHolder <int> holder = 10;
            bool flag = false;

            holder.ValueChanged += (sender, args) => { flag = true; };
            holder.Value         = 100;
            Assert.IsTrue(flag);
        }
Exemplo n.º 21
0
    // Use this for initialization
    void Start()
    {
        this.stateHolder = GetComponent <StateHolder>();
        initPlayers();
        estadoPartida = PARTIDA_STATE.INICIO_RONDA;
        turnoJugador  = TURNO_JUGADOR.PRIMER_JUGADOR;

        GameObject inventarioGameObject = GameObject.FindGameObjectWithTag("MainInventory");

        this.inventario = inventarioGameObject.GetComponent <Inventory>();
        GameObject hotbarGameObject = GameObject.FindGameObjectWithTag("Hotbar");

        this.hotbar                = hotbarGameObject.GetComponent <Inventory>();
        gestorInventario           = this.gameObject.AddComponent <GestionInventario>();
        gestorInventario.inventory = inventarioGameObject;
        gestorHotbar               = this.gameObject.AddComponent <GestionHotbar>();
        gestorHotbar.inventory     = hotbarGameObject;
        condicionFinJuego          = GetComponent <EndGameCondition>();

        gameObject.AddComponent <PlatformSpawner> ();

        //txtTurnoJugador.text = "Turno: " + turnoJugador.ToString();

        ronda = 0;

        turnCounter      = 1;
        numCajasLanzadas = 1;

        this.listaItemsPrimerJugador = new List <int>();
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoAngel);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoEscudoDoble);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoEscudoSimple);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoIglu);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoBomb);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoGrenade);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoSemtex);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoMissile);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoBomb);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoGrenade);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoSemtex);
        listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoMissile);

        this.listaItemsSegundoJugador = new List <int>();
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoAngel);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoEscudoDoble);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoEscudoSimple);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoIglu);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoBomb);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoGrenade);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoSemtex);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoMissile);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoBomb);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoGrenade);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoSemtex);
        listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoMissile);
    }
Exemplo n.º 22
0
        public T NewInstance()
        {
            StateHolder instanceState = this.state == null?this.transientModel.NewInitialState() : this.transientModel.NewState(this.state);

            this.transientModel.State.CheckConstraints(instanceState);

            CompositeInstance compositeInstance = this.transientModel.NewCompositeInstance(this.moduleInstance, this.uses ?? UsesInstance.NoUses, instanceState);

            return((T)compositeInstance.Proxy);
        }
Exemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        speedModifier = 1f;

        mover   = Vector3.zero;
        rotator = Vector3.zero;

        movementCollider  = GetComponent <Collider>();
        movementRigidbody = GetComponent <Rigidbody>();
        stateHolder       = GetComponent <StateHolder>();
    }
        private void ApplyControllerVersions(StateHolder state)
        {
            var controllerVersions = _versions.Where(x => x >= state.ControllerIntroduced.Version);

            if (state.IsControllerMarkedAsRemoved)
            {
                controllerVersions = controllerVersions.Where(x => x < state.ControllerRemoved.Version);
            }

            state.Controller.HasApiVersions(controllerVersions.ToArray());
        }
Exemplo n.º 25
0
        public bool Validate(ValidateCallback callback, StateHolder state)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            if (name.Length == 0)
            {
                if (!callback(Translator.GetString("User name cannot be empty!"), ErrorSeverity.Error, 0, state))
                {
                    return(false);
                }
            }

            User u = GetByName(name);

            if (u != null && u.Id != id)
            {
                if (!callback(string.Format(Translator.GetString("User with the name \"{0}\" already exists! Do you want to save the user anyway?"), name),
                              ErrorSeverity.Warning, 1, state))
                {
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(code))
            {
                u = GetByCode(code);
                if (u != null && u.Id != id)
                {
                    if (!callback(string.Format(Translator.GetString("User with the code \"{0}\" already exists. Do you want to save the user anyway?"), code),
                                  ErrorSeverity.Warning, 2, state))
                    {
                        return(false);
                    }
                }
            }

            if (!string.IsNullOrEmpty(cardNo))
            {
                u = GetByCard(cardNo);
                if (u != null && u.Id != id)
                {
                    if (!callback(string.Format(Translator.GetString("User with the card \"{0}\" already exists. Do you want to save the user anyway?"), cardNo),
                                  ErrorSeverity.Warning, 3, state))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 26
0
 public void SaveState(StateHolder st)
 {
     st.VRC6SawtoothAccumRate       = AccumRate;
     st.VRC6SawtoothAccumStep       = AccumStep;
     st.VRC6SawtoothAccum           = Accum;
     st.VRC6Sawtooth_FreqTimer      = _FreqTimer;
     st.VRC6Sawtooth_Enabled        = _Enabled;
     st.VRC6Sawtooth_Frequency      = _Frequency;
     st.VRC6Sawtooth_SampleCount    = _SampleCount;
     st.VRC6Sawtooth_RenderedLength = _RenderedLength;
     st.VRC6SawtoothOUT             = OUT;
 }
Exemplo n.º 27
0
        public override void Activate()
        {
            FindObjectOfType <EventTextBox>().Close();

            StateHolder stateHolder = FindObjectOfType <StateHolder>();

            stateHolder.SetPhaseToCombat();

            CombatManager combatManager = FindObjectOfType <CombatManager>();

            combatManager.StartCoroutine(combatManager.InitializeCombat());
        }
Exemplo n.º 28
0
 public void LoadState(StateHolder st)
 {
     AccumRate       = st.VRC6SawtoothAccumRate;
     AccumStep       = st.VRC6SawtoothAccumStep;
     Accum           = st.VRC6SawtoothAccum;
     _FreqTimer      = st.VRC6Sawtooth_FreqTimer;
     _Enabled        = st.VRC6Sawtooth_Enabled;
     _Frequency      = st.VRC6Sawtooth_Frequency;
     _SampleCount    = st.VRC6Sawtooth_SampleCount;
     _RenderedLength = st.VRC6Sawtooth_RenderedLength;
     OUT             = st.VRC6SawtoothOUT;
 }
Exemplo n.º 29
0
 public void SaveState(StateHolder st)
 {
     st.VRC6Pulse2_Volume         = _Volume;
     st.VRC6Pulse2DutyPercentage  = DutyPercentage;
     st.VRC6Pulse2_DutyCycle      = _DutyCycle;
     st.VRC6Pulse2_FreqTimer      = _FreqTimer;
     st.VRC6Pulse2_Enabled        = _Enabled;
     st.VRC6Pulse2_Frequency      = _Frequency;
     st.VRC6Pulse2_SampleCount    = _SampleCount;
     st.VRC6Pulse2_RenderedLength = _RenderedLength;
     st.VRC6Pulse2WaveStatus      = WaveStatus;
     st.VRC6Pulse2OUT             = OUT;
 }
Exemplo n.º 30
0
 public void LoadState(StateHolder st)
 {
     _Volume         = st.VRC6Pulse2_Volume;
     DutyPercentage  = st.VRC6Pulse2DutyPercentage;
     _DutyCycle      = st.VRC6Pulse2_DutyCycle;
     _FreqTimer      = st.VRC6Pulse2_FreqTimer;
     _Enabled        = st.VRC6Pulse2_Enabled;
     _Frequency      = st.VRC6Pulse2_Frequency;
     _SampleCount    = st.VRC6Pulse2_SampleCount;
     _RenderedLength = st.VRC6Pulse2_RenderedLength;
     WaveStatus      = st.VRC6Pulse2WaveStatus;
     OUT             = st.VRC6Pulse2OUT;
 }
Exemplo n.º 31
0
 public override IState <PlAYER_STATE> HandleState(StateHolder <PlAYER_STATE> holder, IState <PlAYER_STATE> state)
 {
     switch (state.GetState())
     {
     case PlAYER_STATE.MOVE:
     case PlAYER_STATE.ATTACKED:
     case PlAYER_STATE.ATTACK_AFTER:
     case PlAYER_STATE.ATTACK_BEFORE:
     case PlAYER_STATE.DEAD:
         return(state);
     }
     return(null);
 }
        public bool Apply(IControllerConventionBuilder controller, HttpControllerDescriptor controllerDescriptor)
        {
            var state = new StateHolder(controller, controllerDescriptor);

            if (!state.IsValid)
            {
                return(false);
            }

            ApplyControllerVersions(state);
            ApplyControllerActionVersions(state);

            return(true);
        }
Exemplo n.º 33
0
        // Update is called once per frame
        void Update()
        {
            AudioListener.GetOutputData(waveData, 1);
            volume /= 2.0f;
            volume += waveData.Select(x => x * x).Sum() / waveData.Length * 0.5f;
            var y = Mathf.Sin(StateHolder.GetRhythm() / 10.0f * Mathf.PI * 2.0f) * 0.3f;

            for (int i = 0; i < childCount; i++)
            {
                this.transform.GetChild(i).transform.position   = childTransform[i].position + new Vector3(0.0f, y, 0.0f);
                this.transform.GetChild(i).transform.localScale = childTransform[i].scale * (1.0f + volume * 10.0f);
                this.transform.GetChild(i).transform.Rotate(Vector3.up * Time.deltaTime * 30.0f, Space.World);
            }
        }
Exemplo n.º 34
0
 public void Dispose()
 {
     try
     {
         Close();
     }
     catch (IgniteIllegalStateException)
     {
         _state = new StateHolder(TransactionState.Unknown);
     }
     finally
     {
         GC.SuppressFinalize(this);
     }
 }
Exemplo n.º 35
0
        public StateHolder NewInstance(StateHolder state)
        {
            var properties = new Dictionary<PropertyInfo, Property>();
            foreach (PropertyModel propertyModel in this.propertyModels)
            {
                Property originalProperty = state.GetProperty(propertyModel.PropertyInfo);
                object initialValue = originalProperty.Value;

                initialValue = CloneInitialValue(initialValue, false);

                // Create property instance
                Property property = propertyModel.NewInstance(initialValue);
                properties.Add(propertyModel.PropertyInfo, property);
            }
            return new PropertiesInstance(properties);
        }
Exemplo n.º 36
0
 private static void SetApplicationState(object value)
 {
     TimeSpan timeToLive = new TimeSpan(1, 0, 0);
     SortedList<string, object> list = GetApplicationList();
     object objValue;
     StateHolder holder;
     if (list.TryGetValue(value.GetType().FullName, out objValue))
     {
         holder = objValue as StateHolder;
     }
     else
     {
         holder = new StateHolder();
         list[value.GetType().FullName] = holder;
     }
     holder.State = value;
     holder.LastAccess = DateTime.Now;
     holder.TimeToLive = timeToLive;
 }
Exemplo n.º 37
0
 public StateHolder NewState(StateHolder state)
 {
     return this.stateModel.NewState(state);
 }
Exemplo n.º 38
0
 public void CheckConstraints(StateHolder instanceState)
 {
 }
Exemplo n.º 39
0
 public TransientInstance(AbstractCompositeModel compositeModel, ModuleInstance moduleInstance, object[] mixins, StateHolder state) : base(compositeModel, moduleInstance, mixins, state)
 {
 }
Exemplo n.º 40
0
 public object NewInstance(CompositeInstance compositeInstance, StateHolder stateHolder)
 {
     return this.NewInstance(compositeInstance, stateHolder, UsesInstance.NoUses);
 }
Exemplo n.º 41
0
 //[DebuggerStepThrough]
 ////[DebuggerHidden]
 public object NewInstance(CompositeInstance compositeInstance, StateHolder stateHolder, UsesInstance uses)
 {
     var injectionContext = new InjectionContext(compositeInstance, uses, stateHolder);
     object mixin = this.injectedObjectBuilder.NewInstance(injectionContext);
     return mixin;
 }
Exemplo n.º 42
0
 public StateHolder NewState(StateHolder state)
 {
     return this.propertiesModel.NewInstance(state);
 }
Exemplo n.º 43
0
 public ValueInstance(ValueModel valueModel, ModuleInstance moduleInstance, object[] mixins, StateHolder state)
         : base(valueModel, moduleInstance, mixins, state)
 {
 }