public void Draw(SpriteBatch spriteBatch, Vector2 location, ObjectState state)
        {
            this.SpriteWidth = this.Texture.Width / this.Columns;
            this.SpriteHeight = this.Texture.Height / this.Rows;

            if (state == ObjectState.Moving)
            {
                int row = (int)((float)this.currentFrame / this.Columns);
                int column = this.currentFrame % this.Columns;

                var sourceRectangle = new Rectangle(this.SpriteWidth * column, this.SpriteHeight * row, this.SpriteWidth, this.SpriteHeight);
                var destinationRectangle = new Rectangle((int)location.X, (int)location.Y, this.SpriteWidth, this.SpriteHeight);

                spriteBatch.Begin();
                spriteBatch.Draw(this.Texture, destinationRectangle, sourceRectangle, Color.White, this.Rotation, new Vector2(0, 0), this.Effects, 0f);
                spriteBatch.End();
            }
            else
            {
                var sourceRectangle = new Rectangle(0, 0, this.SpriteWidth, this.SpriteHeight);
                var destinationRectangle = new Rectangle((int)location.X, (int)location.Y, this.SpriteWidth, this.SpriteHeight);

                spriteBatch.Begin();
                spriteBatch.Draw(this.Texture, destinationRectangle, sourceRectangle, Color.White, this.Rotation, new Vector2(0, 0), this.Effects, 0f);
                spriteBatch.End();
            }
        }
Пример #2
0
        public static string getMessageToClient(ObjectState _objectState, string _customerName)
        {
            string messageToClient = string.Empty;

            switch (_objectState)
            {
                case ObjectState.Added:
                    {
                        messageToClient = string.Format("A sales order for {0} has been added to the database.", _customerName);
                    }
                    break;
                case ObjectState.Modified:
                    {
                        messageToClient = string.Format("The customer name for the sales order has been updated to {0} in the database", _customerName);
                    }
                    break;
                case ObjectState.Deleted:
                    {
                        messageToClient = "You are about to permanently deleting this sales order";
                    }
                    break;
                default:
                    messageToClient = string.Format("The orignal value of Customer Name is {0}", _customerName);
                    break;
            }

            return messageToClient;
        }
Пример #3
0
        public bool saved; //RowChanged fired twice during Adding a record;

        #endregion Fields

        #region Constructors

        //true: after record saved
        //false: before record saving, give a chance to deny saving
        public RowChangedEventArgs(RowAdapter adapter, ObjectState state, bool saved)
        {
            this.adapter = adapter;
            this.state = state;
            this.confirmed = true;
            this.saved = saved;
        }
Пример #4
0
 public void SetState(ObjectState State)
 {
     state = State;
     //_interactable = State != ObjectState.Done;
     graphic_dirty.SetActive(State == ObjectState.Dirty);
     graphic_done.SetActive(triggerEvent._triggered);
 }
Пример #5
0
    private void Awake() 
	{
        m_collider2D = GetComponent<Collider2D>();

        // E-man - Begin
        motherShipExplosion = GameObject.Find("MotherShipExplosion");

        if (motherShipExplosion)
        {
            motherShipExplosion.SetActive(false);
        }
        else
        {
            Debug.Log("DopHatch::Awake(), Hey buddy! Can't find your explosion guy!");
        }
        // E-man - End

        m_objectState = GetComponent<ObjectState>();

        Handler = GameObject.Find("Input Handler");
        Ihandler = Handler.GetComponent<InputHandler>();

        GameObject go = GameObject.Find("Pod");
        m_podRigidbody = go.GetComponent<Rigidbody2D>();

        // E-man
        as_explosion = GetComponent<AudioSource>();
        
        if(!fire)
        {
            Debug.Log("DopHatch::Awake(), Hey buddy! Can't seem to find your fire fwiend!");
        }
    }
Пример #6
0
 public ItemInfo(int tex)
     : base(null)
 {
     ID_ = idCounter++;
     tex_ = tex;
     structureID_ = -1;
     state_ = ObjectState.OK;
 }
Пример #7
0
 public void AssignOid(IDatabase db, int oid, bool raw)
 {
     this.oid = oid;
     this.db = db;
     if (raw)
         state |= ObjectState.RAW;
     else
         state &= ~ObjectState.RAW;
 }
Пример #8
0
 public ItemInfo(GameEntity e, ItemInfo parent, int number = 1)
     : base(e)
 {
     ID_ = parent.ID_;
     tex_ = parent.tex_;
     structureID_ = parent.structureID_;
     number_ = number;
     state_ = parent.state_;
 }
Пример #9
0
 public void Apply(ObjectState v)
 {
     State t = v as State;
     X = t.x;
     Y = t.y;
     show_members = t.b1;
     show_full_qual = t.b2;
     RefreshContent();
     SetHidden( t.hidden );
 }
        public void It_maps_attributes_without_values_to_default_values_for_their_typs()
        {
            var objectState = new ObjectState(objectId, objectTypeId);
            dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);

            var snapshot = objectFacade.GetSnapshot(changeSetId);
            var o = snapshot.GetById<TestingObject>(objectId);

            Assert.IsNull(o.TextValue);
            Assert.AreEqual(0, o.IntValue);
        }
        public void It_does_not_map_attributes_that_are_not_listed_in_object_type_descriptor()
        {
            var objectState = new ObjectState(objectId, objectTypeId);
            objectState.ModifyAttribute("NotMappedProperty", 10.5m);
            dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);

            var snapshot = objectFacade.GetSnapshot(changeSetId);
            var o = snapshot.GetById<TestingObject>(objectId);

            Assert.AreEqual(0m, o.NotMappedProperty);
        }
        public void It_maps_attribute_values_to_properties()
        {
            var objectState = new ObjectState(objectId, objectTypeId);
            objectState.ModifyAttribute("TextValue", "SomeValue");
            objectState.ModifyAttribute("IntValue", 42);
            dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);

            var snapshot = objectFacade.GetSnapshot(changeSetId);
            var o = snapshot.GetById<TestingObject>(objectId);

            Assert.AreEqual("SomeValue", o.TextValue);
            Assert.AreEqual(42, o.IntValue);
        }
Пример #13
0
        public static string GetDisplayString(ObjectState state)
        {
            Type type = typeof(ObjectState);
            FieldInfo fieldInfo = type.GetField(state.ToString());
            Attribute attr = fieldInfo.GetCustomAttribute(typeof(EnumDisplayStringAttribute));
            var dispAttr = (EnumDisplayStringAttribute)attr;

            if (dispAttr == null)
            {
                return state.ToString();
            }

            return dispAttr.DisplayString;
        }
Пример #14
0
 public static EntityState ConvertState(ObjectState state)
 {
     switch (state)
     {
         case ObjectState.Added:
             return EntityState.Added;
         case ObjectState.Modified:
             return EntityState.Modified;
         case ObjectState.Deleted:
             return EntityState.Deleted;
         default:
             return EntityState.Unchanged;
     }
 }
 public static string GetMessageToClient(ObjectState objectState, string customerName)
 {
     string meeesageToClient = string.Empty;
        switch (objectState)
        {
        case ObjectState.Added:
            meeesageToClient = string.Format("A's sales order for{0} has been added to the database", customerName);
            break;
        case ObjectState.Modified:
            meeesageToClient = string.Format("The Custoemr name for this sales order has been updated to {0}", customerName);
            break;
        }
        return meeesageToClient;
 }
Пример #16
0
 private static System.Data.Entity.EntityState ConvertState(ObjectState state)
 {
     switch (state)
     {
         case ObjectState.Added:
             return System.Data.Entity.EntityState.Added;
         case ObjectState.Modified:
             return System.Data.Entity.EntityState.Modified;
         case ObjectState.Deleted:
             return System.Data.Entity.EntityState.Deleted;
         default:
             return System.Data.Entity.EntityState.Unchanged;
     }
 }
Пример #17
0
 public void setState(ObjectState state)
 {
     switch (state)
     {
         case ObjectState.OK:
             color_ = Color.White;
             break;
         case ObjectState.DISABLED:
             color_ = Color.Yellow;
             break;
         case ObjectState.DAMAGED:
             color_ = Color.Red;
             break;
     }
 }
Пример #18
0
        public static string GetMessageToClient(ObjectState objectState, string customerName)
        {
            string messageToClient = string.Empty;

            switch (objectState)
            {
                case ObjectState.Added:
                    messageToClient = string.Format("Saving new entry for {0}", customerName);
                    break;
                case ObjectState.Modified:
                    messageToClient = string.Format("Saving changes to {0}", customerName);
                    break;
            }

            return messageToClient;
        }
        public void Getting_object_reference_by_traversing_a_relation_preserves_identity_property()
        {
            var parentObjectId = ObjectId.NewUniqueId();
            var thisObjectState = new ObjectState(objectId, objectTypeId);
            thisObjectState.Attach(parentObjectId, "Parent");
            var parentObjectState = new ObjectState(parentObjectId, objectTypeId);
            parentObjectState.Attach(objectId, "Children");
            dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(thisObjectState);
            dataFacadeMock.Setup(x => x.GetById(parentObjectId, changeSetId)).Returns(parentObjectState);

            var snapshot = objectFacade.GetSnapshot(changeSetId);
            var objectDirectly = snapshot.GetById<TestingObject>(objectId);

            var chidViaParentViaChild = objectDirectly.Parent.Children.First();

            Assert.AreSame(chidViaParentViaChild, objectDirectly);
        }
Пример #20
0
        public static string GetMessageToClient(ObjectState objectState, string employeeName)
        {
            string messageToClient = string.Empty;

            switch (objectState)
            {
                case ObjectState.Added:
                    messageToClient = string.Format("A timesheet for {0} has been added to the database.", employeeName);
                    break;

                case ObjectState.Modified:
                    messageToClient = string.Format("The employee for this timesheet has been updated to {0} in the database.", employeeName);
                    break;
            }

            return messageToClient;
        }
Пример #21
0
    public void UpdateObjectHit(EventTrigger objectHit)
    {
        // current object is changed only if the state is hovering
        // Previous object is no longer hit
        if (currentObject != null &&
            objectHit != currentObject &&
            currentObjectState == ObjectState.Hovering) {
            currentObject.OnHoverOut();
        }

        if (objectHit != null &&
            objectHit != currentObject &&
            currentObjectState == ObjectState.Hovering) {
            currentObjectState = ObjectState.Hovering;
            objectHit.OnHoverIn();
        }

        if (currentObjectState == ObjectState.Hovering) {
            currentObject = objectHit;
        }

        if (currentObject == null) {
            return;
        }

        // We are calling the press only if the current object is being hovered
        if (Input.GetMouseButtonDown(0) &&
            currentObjectState == ObjectState.Hovering) {
            currentObjectState = ObjectState.Pressing;
            currentObject.OnPress();
        }

        // Only if we are currently pressing
        if (Input.GetMouseButtonUp(0) &&
            currentObjectState == ObjectState.Pressing) {
            currentObject.OnRelease();
            currentObjectState = ObjectState.Hovering;

            // Only if we are currently pressing and the object hit is the same we call the on click
            if (objectHit == currentObject) {
                currentObject.OnClick();
            }
        }
    }
 private EntityState ConvertToEFState(ObjectState objectState)
 {
     EntityState efState=EntityState.Unchanged;
     switch (objectState)
     {
         case ObjectState.Added:
             efState= EntityState.Added;
             break;
         case ObjectState.Modified:
             efState= EntityState.Modified;
              break;
         case ObjectState.Deleted:
             efState= EntityState.Deleted;
              break;
         case ObjectState.Unchanged:
             efState= EntityState.Unchanged;
              break;
     }
     return efState;
 }
Пример #23
0
        public static string GetMessageToClient(ObjectState objectState, string customerName)
        {
            string msg = string.Empty;

            switch (objectState)
            {
            case ObjectState.Added:
                msg = string.Format("{0}'s sales order has been added to the database", customerName);
                break;

            case ObjectState.Modified:
                msg = string.Format("{0}'s sales order has been modified", customerName);
                break;

            case ObjectState.Deleted:
            case ObjectState.Unchanged:
            default:
                break;
            }

            return(msg);
        }
Пример #24
0
        public void ChangeTypeClick(object o, EventArgs ev)
        {
            ObjectState before = GetState();

            this.Invalidate();
            switch ((ToolBarIcons)(o as FlatMenuItem).ImageIndex)
            {
            case ToolBarIcons.conn_inher:                       // Inheritance
                type = UmlRelationType.Inheritance;
                break;

            case ToolBarIcons.conn_assoc:                       // Association
                type = UmlRelationType.Association;
                break;

            case ToolBarIcons.conn_aggregation:                     // Aggregation
                type = UmlRelationType.Aggregation;
                break;

            case ToolBarIcons.conn_composition:                         // Composition
                type = UmlRelationType.Composition;
                break;

            case ToolBarIcons.conn_attachm:                     // Attachment
                type = UmlRelationType.Attachment;
                break;

            case ToolBarIcons.conn_realiz:                      // Realization
                type = UmlRelationType.Realization;
                break;

            case ToolBarIcons.conn_dependence:                          // Dependency
                type = UmlRelationType.Dependency;
                break;
            }
            this.Invalidate();
            parent.Undo.Push(new StateOperation(this, before, GetState()), false);
        }
Пример #25
0
        /// <summary>
        /// 在绑定的数据源的焦点行 发生改变前时产生。
        /// </summary>
        private void moveFocusPosition(GridDataRowMoveType moveType)
        {
            ObjectState objectState = MB.WinBase.UIDataEditHelper.Instance.GetObjectState(_EditBindingSource.Current);

            if (checkCanAllowSave())
            {
                return;
            }
            if (objectState == ObjectState.Modified)
            {
                _EditBindingSource.CurrentItemRejectChanges();
            }
            else
            {
                _EditBindingSource.CancelEdit();
            }
            switch (moveType)
            {
            case GridDataRowMoveType.First:
                _MainBindingGridView.MoveFirst();
                break;

            case GridDataRowMoveType.Next:
                _MainBindingGridView.MoveNext();
                break;

            case GridDataRowMoveType.Prev:
                _MainBindingGridView.MovePrev();
                break;

            case GridDataRowMoveType.Last:
                _MainBindingGridView.MoveLast();
                break;

            default:
                break;
            }
        }
Пример #26
0
        /// <summary>
        /// Deserialises the given <see cref="PropertyInfo"/> from the given <see cref="BinaryReader"/>s underlying
        /// <see cref="MemoryStream"/>.
        /// </summary>
        /// <param name="obj"> The <see cref="object"/> whose <see cref="PropertyInfo"/> value to deserialise.</param>
        /// <param name="propertyInfo">
        /// The <see cref="PropertyInfo"/> to deserialise from the given <see cref="BinaryReader"/>s underlying
        /// <see cref="MemoryStream"/>.
        /// </param>
        /// <param name="binaryReader">
        /// The <see cref="BinaryReader"/> from whose underlying <see cref="MemoryStream"/> to deserialise the given
        /// <see cref="PropertyInfo"/>.
        /// </param>
        /// <returns>
        /// The <see cref="object"/> deserialised from the <see cref="MemoryStream"/>. This can be null if the
        /// <see cref="ObjectState"/> is <see cref="ObjectState.Null"/>.
        /// </returns>
        private object DeserialiseObjectFromReader(object obj, PropertyInfo propertyInfo, BinaryReader binaryReader)
        {
            Type propertyType = propertyInfo.PropertyType;

            //We have an enumeration
            if (propertyType.IsEnum)
            {
                return(Enum.Parse(propertyType, binaryReader.ReadString()));
            }

            //We have an array
            if (propertyType.IsArray)
            {
                return(ReadArrayFromStream(obj, propertyInfo, binaryReader));
            }

            //We have a generic list
            if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(List <>))
            {
                return(ReadListFromStream(obj, propertyInfo, binaryReader));
            }

            ObjectState objectState = (ObjectState)binaryReader.ReadByte();

            if (PacketConverterHelper.TypeIsPrimitive(propertyType)) //We have a primitive type
            {
                //If the primitive object is null we just return null, otherwise we deserialise from the stream
                return(objectState == ObjectState.NotNull
                    ? ReadPrimitiveFromStream(propertyType, binaryReader)
                    : null);
            }

            //We have a complex type
            //If the custom object is null we just return null, otherwise we deserialise from the stream
            return(objectState == ObjectState.NotNull
                ? DeserialiseObjectFromReader(PacketConverterHelper.InstantiateObject(propertyType), binaryReader)
                : null);
        }
Пример #27
0
        public ObjectParser(ObjectState state)
        {
            _state = state;
            switch (state)
            {
            case ObjectState.ReadyForFirstKey:
                NextChar(StructuralChar.StringDelimiter, () => new StringParser().ReturningTo(new ObjectParser(ObjectState.ReadyForColon).ReturningTo(Return)));
                NextChar(StructuralChar.Whitespace, () => this);     // Ignore it
                NextChar(StructuralChar.ObjectEnd, () => new ObjectParser(ObjectState.Completed).ReturningTo(Return));
                break;

            case ObjectState.ReadyForKey:
                NextChar(StructuralChar.StringDelimiter, () => new StringParser().ReturningTo(new ObjectParser(ObjectState.ReadyForColon).ReturningTo(Return)));
                NextChar(StructuralChar.Whitespace, () => this);     // Ignore it
                break;

            case ObjectState.ReadyForColon:
                NextChar(StructuralChar.Whitespace, () => this);     // Ignore it
                NextChar(StructuralChar.KeyValueSeparator, () => new ObjectParser(ObjectState.ReadyForValue).ReturningTo(Return));
                break;

            case ObjectState.ReadyForValue:
                NextCanBeValueReturningTo(() => new ObjectParser(ObjectState.ReadyForNext).ReturningTo(Return));
                break;

            case ObjectState.ReadyForNext:
                NextChar(StructuralChar.Whitespace, () => this);     // Ignore it
                NextChar(StructuralChar.ObjectEnd, () => new ObjectParser(ObjectState.Completed).ReturningTo(Return));
                NextChar(StructuralChar.Comma, () => new ObjectParser(ObjectState.ReadyForKey).ReturningTo(Return));
                break;

            case ObjectState.Completed:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, null);
            }
        }
        internal static string ToString(ObjectState state)
        {
            switch (state)
            {
            case ObjectState.Starting:
                return("Starting");

            case ObjectState.Started:
                return("Started");

            case ObjectState.Stopping:
                return("Stopping");

            case ObjectState.Stopped:
                return("Stopped");

            case ObjectState.Unknown:
                return("Unknown");

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, null);
            }
        }
Пример #29
0
    private List <GameObject> GetObjectList(int startIdx, int count, bool active, Vector3 pos, Vector3 rot, Vector3 scale)
    {
        InActiveCount -= count;
        ActiveCount   += count;

        for (int i = startIdx; i < startIdx + count; ++i)
        {
            ObjectState state = objectList[i].GetComponent <ObjectState>();
            state.IsUse = active;
        }

        if (VEasyPoolerManager.manager.getOnResetTransform == true)
        {
            for (int i = startIdx; i < startIdx + count; ++i)
            {
                objectList[i].transform.position    = pos;
                objectList[i].transform.eulerAngles = rot;
                objectList[i].transform.localScale  = scale;
            }
        }

        return(objectList.GetRange(startIdx, count));
    }
Пример #30
0
        /// <summary>
        /// 获取应用程序池和站点的状态
        /// </summary>
        /// <param name="serverIP">服务器IP</param>
        /// <param name="webName">站点名称</param>
        /// <returns></returns>
        public static string GetWebState(string serverIP, string webName)
        {
            ObjectState poolState = ObjectState.Unknown;
            ObjectState siteState = ObjectState.Unknown;

            using (ServerManager sm = ServerManager.OpenRemote(serverIP))
            {
                //应用程序池
                ApplicationPool appPool = sm.ApplicationPools.FirstOrDefault(x => x.Name.ToUpper() == webName.ToUpper());
                if (appPool != null)
                {
                    poolState = appPool.State;
                }

                //Site
                Site site = sm.Sites.FirstOrDefault(x => x.Name.ToUpper() == webName.ToUpper());
                if (site != null)
                {
                    siteState = site.State;
                }
            }
            return($"{poolState.ToString()} | {siteState.ToString()}");
        }
Пример #31
0
    void ChangeMood(int mood)
    {
        switch (mood)
        {
        case 0:
        {
            objectState = ObjectState.Angry;
            break;
        }

        case 1:
        {
            objectState = ObjectState.Happy;
            break;
        }

        case 2:
        {
            objectState = ObjectState.Sad;
            break;
        }
        }
    }
Пример #32
0
        public static EntityState ConvertState(ObjectState state)
        {
            switch (state)
            {
            case ObjectState.Added:
                return(EntityState.Added);

            case ObjectState.Modified:
                return(EntityState.Modified);

            case ObjectState.Deleted:
                return(EntityState.Deleted);

            case ObjectState.Detached:
                return(EntityState.Detached);

            case ObjectState.Unchanged:
                return(EntityState.Unchanged);

            default:
                return(EntityState.Unchanged);
            }
        }
Пример #33
0
    // Start is called before the first frame update
    void Start()
    {
        pantheroffset = Random.Range(-0.99f, 0.99f);
        StartPosition = this.transform.position;
        thisAnim      = this.GetComponent <Animator>();
        Player        = GameObject.Find("character");
        BloodSplatter = GameObject.Find("splat");

        _state = StatefulObject.GetState(gameObject);
        if (null == _state)
        {
            Debug.Log("What " + GetComponent <StatefulObject>().UniqueID);
        }

        if (ObjectState.ObjectStates.Dead == _state.State)
        {
            GameObject splatter = GameObject.Instantiate(BloodSplatter);
            transform.position                         = _state.Position;
            splatter.transform.position                = this.transform.position;
            GetComponent <SpriteRenderer>().enabled    = false;
            GetComponent <PolygonCollider2D>().enabled = false;
        }
    }
        public void DrawButton(PaintEventArgs args, ObjectState state)
        {
            using (GraphicsCache cache = new GraphicsCache(args)) {
                SkinElement     element = CommonSkins.GetSkin(UserLookAndFeel.Default)[CommonSkins.SkinButton];
                SkinElementInfo info    = new SkinElementInfo(element, ButtonRectangle);

                if (state == ObjectState.Normal)
                {
                    info.ImageIndex = 0;
                }
                if (state == ObjectState.Hot)
                {
                    info.ImageIndex = 1;
                }
                if (state == ObjectState.Pressed)
                {
                    info.ImageIndex = 2;
                }
                DrawSkinImage(cache, info);
                DrawText(cache);
                DrawImage(cache);
            }
        }
Пример #35
0
            private static void ReadCallback(IAsyncResult ar)
            {
                string      content  = string.Empty;
                ObjectState state    = (ObjectState)ar.AsyncState;
                Socket      handler  = state.WSocket;
                int         byteRead = handler.EndReceive(ar);

                if (byteRead > 0)
                {
                    state.sb.Append(Encoding.ASCII.GetString(state.buff, 0, byteRead));
                    content = state.sb.ToString();
                    if (content.Contains("<EOF>"))
                    {
                        //content.IndexOf(@"<EOF>", StringComparison.CurrentCulture) > -1
                        frm.UpdateMon($"Read: {content.Length} bytes from  socket Data: {content}");
                        Send(handler, content);
                    }
                    else
                    {
                        handler.BeginReceive(state.buff, 0, ObjectState.buffSize, 0, new AsyncCallback(ReadCallback), state);
                    }
                }
            }
Пример #36
0
    public void CreateState(PlayerStates _state)
    {
        player.inAction = false;
        switch (_state)
        {
        case PlayerStates.Move:
            actualState = new MoveState(player);
            break;

        case PlayerStates.Air:
            actualState = new AirState(player);
            break;

        case PlayerStates.Hang:
            actualState = new HangState(player);
            break;

        case PlayerStates.Action:
            player.inAction = true;
            actualState     = new ActionState(player);
            break;

        case PlayerStates.RunState:
            player.inAction = true;
            actualState     = new BaseRunState(player);
            break;

        case PlayerStates.AirRunState:
            player.inAction = true;
            actualState     = new AirRunState(player);
            break;

        default:
            actualState = new MoveState(player);
            break;
        }
    }
Пример #37
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.GetComponent <ObjectState>())
        {
            ObjectState otherState = collision.gameObject.GetComponent <ObjectState>();
            switch (_elem)
            {
            case ShootScript.Element.FIRE:
                if (_fireSplash)
                {
                    Instantiate(_fireSplash, transform.position, transform.rotation);
                }
                otherState.SetState(otherState.SetStateWFire());
                otherState.SetPosition(transform.position);
                break;

            case ShootScript.Element.WATER:
                if (_waterSplash)
                {
                    Instantiate(_waterSplash, transform.position, transform.rotation);
                }
                collision.GetComponentInParent <ObjectGeneration>().ExtinguishFire();
                Debug.Log("Water");
                break;

            case ShootScript.Element.ELECTRICITY:
                otherState.SetState(otherState.SetStateWElec());
                //Debug.Log(otherState.GetState());
                Debug.Log("Electricity");
                break;
            }
        }
        if (collision.gameObject.tag != "Player" && collision.gameObject.tag != "Checkpoint" && collision.gameObject.tag != "DontTrigger" && collision.gameObject.tag != "Projectile")
        {
            DestroyObject(gameObject);
        }
    }
Пример #38
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (ServerManager manager = new ServerManager())
                {
                    ApplicationPoolCollection applicationPoolCollection = manager.ApplicationPools;

                    List <string> pools    = new List <string>();
                    List <string> poolList = new List <string>();
                    foreach (ApplicationPool applicationPool in applicationPoolCollection)
                    {
                        poolList.Add($"Pool '{applicationPool.Name}' - State: {applicationPool.State}");
                        if (applicationPool.State == ObjectState.Stopped && !applicationPool.Name.ToLower().Contains("trunk"))
                        {
                            ObjectState state = applicationPool.Start();
                            EventLog.WriteEntry(Source, $"Started {applicationPool.Name} application pool(s)", EventLogEntryType.Warning);
                            AddStarted(applicationPool.Name);
                            if (NeedsNotified(applicationPool.Name))
                            {
                                pools.Add(applicationPool.Name);
                            }
                        }
                    }

                    if (pools.Count > 0)
                    {
                        EventLog.WriteEntry(Source, $"Started {pools.Count} application pool(s)", EventLogEntryType.Information);
                    }
                    SendNotification(pools);
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry(Source, $"{ex.Message}\n\n{ex.StackTrace}", EventLogEntryType.Error);
            }
        }
Пример #39
0
        /// <summary>
        /// Notifies the observers.
        /// </summary>
        public static void NotifyObservers(ObjectState state)
        {
            try
            {
                LogManager.WriteLog("|##> Object State : " + state.ToString(),
                                    LogManager.enumLogLevel.Info);

                foreach (ObjectStateObserver observer in GetObservers())
                {
                    try
                    {
                        observer.NotifyState(state);
                    }
                    catch (Exception ex)
                    {
                        ExceptionManager.Publish(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
Пример #40
0
        internal static EntityState ConvertToEFState(ObjectState objectState)
        {
            EntityState efState = EntityState.Unchanged;

            switch (objectState)
            {
            case ObjectState.NEW:
                efState = EntityState.Added;
                break;

            case ObjectState.MODIFIED:
                efState = EntityState.Modified;
                break;

            case ObjectState.DELETED:
                efState = EntityState.Deleted;
                break;

            case ObjectState.UNCHANGED:
                efState = EntityState.Unchanged;
                break;
            }
            return(efState);
        }
Пример #41
0
        /// <summary>
        /// Actually create this GraphicsResource resources.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for allocating resources.
        /// </param>
        /// <remarks>
        /// All resources linked with <see cref="LinkResource(IGraphicsResource)"/> will be automatically created.
        /// </remarks>
        protected override void CreateObject(GraphicsContext ctx)
        {
            // Create geometry state, if necessary
            if (VertexArray != null && VertexArray.Exists(ctx) == false)
            {
                VertexArray.Create(ctx);
            }
            // Define program, if necessary
            if (Program == null && ProgramTag != null)
            {
                Program = ctx.CreateProgram(ProgramTag);
            }
            // Create program, if necessary
            if (Program != null && Program.Exists(ctx) == false)
            {
                Program.Create(ctx);
            }

            // Create instance-only resources
            foreach (Geometry geometry in _GeometryInstances)
            {
                geometry.Create(ctx);
            }

            // In place base.CreateObject implementation

            // Create object state
            ObjectState.Create(ctx, Program);
            // Base implementation
            base.CreateObject(ctx);
            // Propagate creation to hierarchy
            foreach (SceneObject sceneGraphObject in _Children)
            {
                sceneGraphObject.Create(ctx);
            }
        }
Пример #42
0
    public static List <ObjectState> RemoveDuplicates(List <ObjectState> objectStates)
    {
        List <ObjectState> newObjectStates = new List <ObjectState>();

        for (int i = 0; i < objectStates.Count; i++)
        {
            ObjectState objectState = objectStates[i];

            if (objectState == null)
            {
                continue;
            }

            bool isDuplicate = false;

            for (int j = 0; j < newObjectStates.Count; j++)
            {
                ObjectState os = newObjectStates[j];

                if (objectState.EqualsObject(os))
                {
                    isDuplicate = true;
                    break;
                }
            }

            if (isDuplicate)
            {
                continue;
            }

            newObjectStates.Add(objectState);
        }

        return(newObjectStates);
    }
Пример #43
0
        /// <summary>
        /// Queries the instance and returns its <see cref="EntityState" />.
        /// </summary>
        /// <param name="instance">The instance to query.</param>
        /// <returns>The <see cref="EntityState" /> for the instance.</returns>
        public static EntityState GetState(T instance)
        {
            ObjectState state = GetObjectState(instance);

            switch (state)
            {
            case ObjectState.Inserted:
                return(EntityState.New);

            case ObjectState.Unchanged:
                return(EntityState.Unchanged);

            case ObjectState.Updated:
                return(EntityState.Changed);

            case ObjectState.Deleted:
                return(EntityState.Deleted);

            case ObjectState.Unknown:
                return(EntityState.Unknown);
            }
            //otherwise throw an error
            throw new DataProviderException("Unable to determine entity state for instance");
        }
        public void SetUpdatePacket(PlayerUpdatePacket updatePacket)
        {
            _updatePacket            = updatePacket;
            simulationState.Rotation = _updatePacket.Rotation;
            simulationState.Position = new Vector2(_updatePacket.XPosition, _updatePacket.YPosition);
            simulationState.Speed    = _updatePacket.Speed;

            if (Application.APPLY_ENTITY_INTERPOLATION)
            {
                // Start a new smoothing interpolation from our current
                // state toward this new state we just received.
                previousState     = PlayerState;
                _currentSmoothing = 1;
            }
            else
            {
#pragma warning disable CS0162
                _currentSmoothing = 0;
#pragma warning restore CS0162
            }

            // TODO: APPLY PREDICTION
            //ApplyPrediction(gameTime, latency, packetSendTime);
        }
Пример #45
0
        public void DisplayOptions(object o, EventArgs ev)
        {
            ObjectState before = GetState();

            switch ((o as FlatMenuItem).Index)
            {
            case 0:                     // Attributes
                show_vars = !show_vars;
                break;

            case 1:                     // Operations
                show_members = !show_members;
                break;

            case 2:                     // Properties
                show_properties = !show_properties;
                break;

            case 3:                     // full title
                show_full_qual = !show_full_qual;
                break;

            case 4:                     // method signatures
                show_method_signatures = !show_method_signatures;
                break;

            case 5:                     // only public
                show_only_public = !show_only_public;
                break;

            default:
                return;
            }
            RefreshContent();
            parent.Undo.Push(new StateOperation(this, before, GetState()), false);
        }
Пример #46
0
        private static EntityState ConvertToEFState(ObjectState objectState)
        {
            EntityState efState = EntityState.Unchanged;

            switch (objectState)
            {
            case ObjectState.Added:
                efState = EntityState.Added;
                break;

            case ObjectState.Modified:
                efState = EntityState.Modified;
                break;

            case ObjectState.Deleted:
                efState = EntityState.Deleted;
                break;

            case ObjectState.Unchanged:
                efState = EntityState.Unchanged;
                break;
            }
            return(efState);
        }
Пример #47
0
        /// <summary>
        /// Sets a DataState for the given cell
        /// </summary>
        public static IXLCell SetDataState(this IXLCell cell, ObjectState dataState)
        {
            cell.DataType = XLCellValues.Text;

            switch (dataState)
            {
            case ObjectState.Added:
                cell.Value = "Feliratkozott";
                cell.Style.Fill.BackgroundColor = XLColor.Red;
                break;

            case ObjectState.Modified:
                cell.Value = "Adatm\u00F3dos\u00EDt\u00E1s";
                cell.Style.Fill.BackgroundColor = XLColor.Orange;
                break;

            case ObjectState.Deleted:
                cell.Value = "Leiratkozott";
                cell.Style.Fill.BackgroundColor = XLColor.Blue;
                break;
            }

            return(cell);
        }
    public void Start()
    {
        var all = new List <PropertyAccessor>(GameObject.FindObjectsOfType <PropertyAccessor>());
        List <GameObject> objs = new List <GameObject>();

        for (int i = 0; i < all.Count; i++)
        {
            if (all[i].Attributes == null)
            {
                Debug.Log("Attributes for " + all[i].gameObject.name + " not loaded");
            }
            if (all[i].Attributes.Memorable)
            {
                objs.Add(all[i].gameObject);
            }
        }
        memorableObjects = objs.ToArray();
        states           = new ObjectState[all.Count, MAX_MEM];
        beginStates      = new ObjectState[memorableObjects.Length];
        for (int i = 0; i < beginStates.Length; i++)
        {
            beginStates[i] = new ObjectState(memorableObjects[i]);
        }
    }
Пример #49
0
        public void Update(ref ObjectState state, float deltaTime)
        {
            // Limit the max speed
            if (state.Speed > Application.PLAYER_MAX_SPEED)
            {
                state.Speed = Application.PLAYER_MAX_SPEED;
            }
            else if (state.Speed < -Application.PLAYER_MAX_SPEED)
            {
                state.Speed = -Application.PLAYER_MAX_SPEED;
            }

            Vector2 direction = new Vector2((float)Math.Cos(state.Rotation),
                                            (float)Math.Sin(state.Rotation));

            direction.Normalize();

            state.Position += direction * state.Speed;
            state.Speed    *= Application.PLAYER_DECELERATION_AMOUNT;

            // Make sure that the player does not go out of bounds
            state.Position.X = MathHelper.Clamp(state.Position.X, 0, Application.WINDOW_WIDTH);
            state.Position.Y = MathHelper.Clamp(state.Position.Y, 0, Application.WINDOW_HEIGHT);
        }
Пример #50
0
        private EntityState ChangeObjectStateToEntityState(ObjectState objectState)
        {
            EntityState entityState;

            switch (objectState)
            {
            case ObjectState.Added:
                entityState = EntityState.Added;
                break;

            case ObjectState.Modified:
                entityState = EntityState.Modified;
                break;

            case ObjectState.Deleted:
                entityState = EntityState.Deleted;
                break;

            default:
                entityState = EntityState.Unchanged;
                break;
            }
            return(entityState);
        }
Пример #51
0
        /// <summary>
        /// 启动一个站点
        /// </summary>

        public static BaseResult StartSite(string site)
        {
            BaseResult result = BaseResult.Fail("未知错误");

            try
            {
                ServerManager iisManager = new ServerManager();
                if (iisManager.Sites[site].State != ObjectState.Started || iisManager.Sites[site].State != ObjectState.Starting)
                {
                    ObjectState state = iisManager.Sites[site].Start();
                    if (state == ObjectState.Starting || state == ObjectState.Started)
                    {
                        result.Status        = true;
                        result.StatusMessage = site + ":站点已启动";
                    }
                    else
                    {
                        result.Status        = false;
                        result.StatusMessage = site + ":站点停止失败";
                    }
                }
                else
                {
                    result.Status        = true;
                    result.StatusMessage = site + ":站点已是启动状态";
                }
            }
            catch (Exception ex)
            {
                //NLogHelper.Warn(ex, " public static BaseResult StartSite(string site)");
                result.Status        = false;
                result.StatusMessage = site + ":站点停止出现异常:" + ex.Message;
            }

            return(result);
        }
Пример #52
0
 public virtual void SetRowState(ObjectState rs)
 {
     throw new NotSupportedException();
 }
Пример #53
0
        /// <summary>
        /// Blocks until the application is in the specified state or until the timeout expires
        /// Note: If the timeout expires without the state condition being true, the method throws a TimeoutException
        /// </summary>
        /// <param name="waitForState">State to wait on.</param>
        /// <param name="milliseconds">Timeout in milliseconds.</param>
        private void WaitApp(ObjectState waitForState, int milliseconds)
        {
            using (ServerManager serverMgr = new ServerManager())
            {
                Site site = serverMgr.Sites[this.appName];

                int timeout = 0;
                while (timeout < milliseconds)
                {
                    try
                    {
                        if (site.State == waitForState)
                        {
                            return;
                        }
                    }
                    catch (System.Runtime.InteropServices.COMException)
                    {
                        // TODO log the exception as warning
                    }

                    Thread.Sleep(25);
                    timeout += 25;
                }

                if (site.State != waitForState)
                {
                    throw new TimeoutException(Strings.AppStartOperationExceeded);
                }
            }
        }
Пример #54
0
 /// <summary>
 /// Raises all BeforeSection events. These events are raised before a section is commited to the datastore
 /// </summary>
 public static void BeforeSection(Section section, ObjectState state, ApplicationType appType)
 {
     CSApplication.Instance().ExecutePreSectionUpdate(section,state,appType);
 }
Пример #55
0
 /// <summary>
 /// Raises all BeforeUser events. These events are raised before any committements are
 /// made to the User (create or update)
 /// </summary>
 public static void BeforeUser(User user, ObjectState state)
 {
     CSApplication.Instance().ExecutePreUserUpdate(user,state);
 }
Пример #56
0
 /// <summary>
 /// Raises all BeforePost events. These events are raised before a post is commited to the datastore
 /// </summary>
 public static void BeforePost(Post post, ObjectState state, ApplicationType appType)
 {
     CSApplication.Instance().ExecutePrePostUpdateEvents(post,state,appType);
 }
Пример #57
0
 /// <summary>
 /// Raises all BeforeGroup events. These events are raised before a group change is commited to the datastore
 /// </summary>
 public static void BeforeGroup(Group group, ObjectState state, ApplicationType appType)
 {
     CSApplication.Instance().ExecutePreSectionGroupUpdate(group,state,appType);
 }
Пример #58
0
 /// <summary>
 /// Raises all AfterUser events. These events are raised after changes (created or update) are 
 /// made to the datastore
 /// </summary>
 public static void AfterUser(User user, ObjectState state)
 {
     CSApplication.Instance().ExecutePostUserUpdate(user,state);
 }
Пример #59
0
        public virtual void Deallocate()
        {
            if (0 == oid)
                return;

            db.deallocateObject(this);
            db = null;
            oid = 0;
            state = 0;
        }
Пример #60
0
        public virtual void Store()
        {
            if ((state & ObjectState.RAW) != 0)
                throw new DatabaseException(DatabaseException.ErrorCode.ACCESS_TO_STUB);

            if (db != null)
            {
                db.storeObject(this);
                state &= ~ObjectState.DIRTY;
            }
        }