예제 #1
0
 protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation,
                                                         UpdateFlags updateFlags)
 {
     base.WriteTypeSpecificMovementUpdate(writer, relation, updateFlags);
     writer.Write(m_entry.VehicleId);
     writer.Write(m_entry.VehicleAimAdjustment);
 }
예제 #2
0
 internal void RegisterUpdate(UpdateFlags flags)
 {
     if (this.Owner != null)
     {
         this.Owner.updateService.RegisterUpdate((int)flags);
     }
 }
예제 #3
0
 internal void Update(UpdateFlags flags)
 {
     if ((flags & UpdateFlags.AffectsDecorations) == UpdateFlags.AffectsDecorations)
     {
         this.RecycleAllDecorators();
     }
 }
예제 #4
0
 internal void OnUpdate(UpdateFlags updateFlags)
 {
     if ((updateFlags & UpdateFlags.AffectsContent) == UpdateFlags.AffectsContent)
     {
         this.strategy.FullyRecycle();
     }
 }
 /// <summary>
 /// Initializes a new instance of the MongoUpdateOptions class.
 /// </summary>
 /// <param name="collection">The collection from which to get default settings for the options.</param>
 public MongoUpdateOptions(
     MongoCollection collection
 ) {
     this.checkElementNames = true;
     this.flags = UpdateFlags.None;
     this.safeMode = collection.Settings.SafeMode;
 }
예제 #6
0
        public WriteConcernResult Update(IMongoQuery query, UpdateBuilder update, UpdateFlags updateFlags, WriteConcern writeConcern)
        {
            //TODO:  paul, deal with auditing
            IMongoQuery fixedQuery = MongoUtil.FormatIdElementForMongoQuery(query);

            return(Collection.Update(query, update, updateFlags, writeConcern));
        }
예제 #7
0
 void AddCube(NBTBlock generator, byte blockData, UpdateFlags updateFlag)
 {
     UnityEngine.Profiling.Profiler.BeginSample("AddCube");
     if (generator is NBTStationaryWater)
     {
         if (updateFlag.HasFlag(UpdateFlags.Water))
         {
             generator.AddCube(this, blockData, pos, water);
         }
     }
     else if (generator is NBTPlant || generator is NBTSnowLayer)
     {
         if (updateFlag.HasFlag(UpdateFlags.NotCollidable))
         {
             generator.AddCube(this, blockData, pos, notCollidable);
         }
     }
     else
     {
         if (updateFlag.HasFlag(UpdateFlags.Collidable))
         {
             generator.AddCube(this, blockData, pos, collidable);
         }
     }
     UnityEngine.Profiling.Profiler.EndSample();
 }
예제 #8
0
파일: ModBase.cs 프로젝트: THDigi/PaintGun
 void IModBase.ComponentSetNewFlags(IComponent component, UpdateFlags newFlags)
 {
     UpdateList(component, ComponentUpdateInput, newFlags, UpdateFlags.UPDATE_INPUT);
     UpdateList(component, ComponentUpdateBeforeSim, newFlags, UpdateFlags.UPDATE_BEFORE_SIM);
     UpdateList(component, ComponentUpdateAfterSim, newFlags, UpdateFlags.UPDATE_AFTER_SIM);
     UpdateList(component, ComponentUpdateDraw, newFlags, UpdateFlags.UPDATE_DRAW);
 }
예제 #9
0
	void RebuildAll()
	{
		UpdateMaterial();

		updateFlags = UpdateFlags.UpdateNone;
		SetNeedUpdate(UpdateFlags.UpdateAll);
	}
예제 #10
0
    public static void SetBlockByte(int x, int y, int z, byte type)
    {
        int chunkX = Mathf.FloorToInt(x / 16f);
        int chunkZ = Mathf.FloorToInt(z / 16f);

        int xInChunk = x - chunkX * 16;
        int zInChunk = z - chunkZ * 16;

        NBTChunk    chunk        = GetChunk(chunkX, chunkZ);
        NBTBlock    oldGenerator = NBTGeneratorManager.GetMeshGenerator(chunk.GetBlockByte(xInChunk, y, zInChunk));
        UpdateFlags updateFlag   = GetUpdateFlags(oldGenerator);

        if (type == 0)
        {
            chunk.GetBlockData(xInChunk, y + 1, zInChunk, out byte topType, out byte topData);
            NBTBlock topGenerator = NBTGeneratorManager.GetMeshGenerator(topType);
            if (topGenerator != null && topGenerator is NBTPlant)
            {
                BreakBlockEffect.Create(topType, topData, new Vector3(x, y + 1, z));
                chunk.SetBlockByte(xInChunk, y + 1, zInChunk, 0);
                updateFlag |= UpdateFlags.NotCollidable;
            }
        }

        chunk.SetBlockByte(xInChunk, y, zInChunk, type);
        if (updateFlag.HasFlag(UpdateFlags.Lighting))
        {
            UpdateLighting(x, y, z);
        }
        chunk.RebuildMesh(updateFlag);

        NBTChunk leftChunk = GetChunk(chunkX - 1, chunkZ);

        if (xInChunk == 0)
        {
            leftChunk.RebuildMesh();
        }

        NBTChunk rightChunk = GetChunk(chunkX + 1, chunkZ);

        if (xInChunk == 15)
        {
            rightChunk.RebuildMesh();
        }

        NBTChunk backChunk = GetChunk(chunkX, chunkZ - 1);

        if (zInChunk == 0)
        {
            backChunk.RebuildMesh();
        }

        NBTChunk frontChunk = GetChunk(chunkX, chunkZ + 1);

        if (zInChunk == 15)
        {
            frontChunk.RebuildMesh();
        }
    }
예제 #11
0
 public void MarkForUpdate(UpdateFlags flag, IGTFGraphElementModel model = null)
 {
     EditorDataModel?.SetUpdateFlag(flag);
     if (model != null)
     {
         EditorDataModel?.AddModelToUpdate(model);
     }
 }
예제 #12
0
		public MovementBlock(UpdateBlock update)
		{
			Update = update;
			UpdateFlags = (UpdateFlags)update.ReadUShort();
			ObjectTypeId = update.ObjectType;

			this.Parse();
		}
예제 #13
0
 /// <summary>
 /// Initializes a new instance of the MongoUpdateOptions class.
 /// </summary>
 /// <param name="collection">The collection from which to get default settings for the options.</param>
 public MongoUpdateOptions(
     MongoCollection collection
     )
 {
     this.checkElementNames = true;
     this.flags             = UpdateFlags.None;
     this.safeMode          = collection.Settings.SafeMode;
 }
예제 #14
0
        public MovementBlock(UpdateBlock update)
        {
            Update       = update;
            UpdateFlags  = (UpdateFlags)update.ReadUShort();
            ObjectTypeId = update.ObjectType;

            this.Parse();
        }
예제 #15
0
 public void Init(bool force)
 {
     if (force)
     {
         updateFlags |= UpdateFlags.UpdateBuffers;
     }
     Init();
 }
 // constructors
 internal MongoUpdateMessage(BsonBinaryWriterSettings writerSettings, string collectionFullName, bool checkUpdateDocument, UpdateFlags flags, IMongoQuery query, IMongoUpdate update)
     : base(MessageOpcode.Update, null, writerSettings)
 {
     this.collectionFullName = collectionFullName;
     this.checkUpdateDocument = checkUpdateDocument;
     this.flags = flags;
     this.query = query;
     this.update = update;
 }
예제 #17
0
 // constructors
 internal MongoUpdateMessage(BsonBinaryWriterSettings writerSettings, string collectionFullName, bool checkUpdateDocument, UpdateFlags flags, IMongoQuery query, IMongoUpdate update)
     : base(MessageOpcode.Update, null, writerSettings)
 {
     this.collectionFullName  = collectionFullName;
     this.checkUpdateDocument = checkUpdateDocument;
     this.flags  = flags;
     this.query  = query;
     this.update = update;
 }
        public virtual bool Update(Guid id, IMongoUpdate update, UpdateFlags updateFlag = UpdateFlags.None)
        {
            if (updateFlag == UpdateFlags.None)
            {
                return(!GetCollection(CollectionName).Update(Query.EQ("_id", new BsonBinaryData(id)), update).HasLastErrorMessage);
            }

            return(!GetCollection(CollectionName).Update(Query.EQ("_id", new BsonBinaryData(id)), update, updateFlag).HasLastErrorMessage);
        }
예제 #19
0
        public void UpdateImage(int image, IEnumerable <UpdateCommand> cmds, UpdateFlags updateFlags)
        {
            ErrorCode ret;
            int       bits;

            switch (IntPtr.Size)
            {
            case 4:
                bits = 32;
                break;

            case 8:
                bits = 64;
                break;

            default:
                throw new PlatformNotSupportedException();
            }
            switch (bits)
            {
            case 32:
                UpdateCommand32[] cmds32 = cmds.Select(x => x.ToNativeStruct32()).ToArray();
                try
                {
                    ret = NativeMethods.UpdateImage32(_ptr, image, cmds32, (uint)cmds32.Length, updateFlags);
                }
                finally
                {
                    foreach (UpdateCommand32 cmd32 in cmds32)
                    {
                        cmd32.Free();
                    }
                }
                break;

            case 64:
                UpdateCommand64[] cmds64 = cmds.Select(x => x.ToNativeStruct64()).ToArray();
                try
                {
                    ret = NativeMethods.UpdateImage64(_ptr, image, cmds64, (ulong)cmds64.Length, updateFlags);
                }
                finally
                {
                    foreach (UpdateCommand64 cmd64 in cmds64)
                    {
                        cmd64.Free();
                    }
                }
                break;

            default:
                throw new PlatformNotSupportedException();
            }

            WimLibException.CheckWimLibError(ret);
        }
예제 #20
0
        protected override void BeginProcessing()
        {
            if (_Update == null) throw new PSArgumentException(_UpdateError ?? TextParameterUpdate); //_131102_111738

            if (Add)
                _Flags |= UpdateFlags.Upsert;

            if (All)
                _Flags |= UpdateFlags.Multi;
        }
예제 #21
0
	void SetNeedUpdate(UpdateFlags uf) {
		if (updateFlags == UpdateFlags.UpdateNone) {
			updateFlags |= uf;
			tk2dUpdateManager.QueueCommit(this);
		}
		else {
			// Already queued
			updateFlags |= uf;
		}
	}
예제 #22
0
 internal void OnProperyChange(UpdateFlags flags)
 {
     if (this.Model != null)
     {
         var update = new Update <UpdateFlags> {
             Sender = this, Flags = flags
         };
         this.Model.GridView.UpdateService.RegisterUpdate(update);
     }
 }
예제 #23
0
 /// <summary>
 /// Same as <see cref="UpdateMethods"/> but simpler for toggling.
 /// </summary>
 /// <param name="flag">The flag to change.</param>
 /// <param name="on">true to add, false to remove.</param>
 public void SetUpdateMethods(UpdateFlags flag, bool on)
 {
     if (on)
     {
         UpdateMethods = UpdateMethods | flag;
     }
     else
     {
         UpdateMethods = UpdateMethods & ~flag;
     }
 }
예제 #24
0
파일: ModBase.cs 프로젝트: THDigi/PaintGun
 void UpdateList(IComponent component, List <IComponent> list, UpdateFlags newFlags, UpdateFlags flag)
 {
     if (component.CurrentUpdateMethods.IsSet(flag) && !newFlags.IsSet(flag))
     {
         list.Remove(component);
     }
     else if (!component.CurrentUpdateMethods.IsSet(flag) && newFlags.IsSet(flag))
     {
         list.Add(component);
     }
 }
예제 #25
0
        public bool Update(IMongoQuery query, IMongoUpdate update, UpdateFlags flags)
        {
            Exception a;
            object    b;

            if (FaultDispatcher.Trap(out a, out b))
            {
                return(HandleFaultEvent <bool>(MongoRepositoryHelper.Method.UPDATE_CAS, a, b));
            }

            return(this.repository.Update(query, update, flags));
        }
예제 #26
0
        internal void Update(UpdateFlags flags)
        {
            if ((flags & UpdateFlags.AffectsContent) == UpdateFlags.AffectsContent)
            {
                this.FullyRecycle();
            }

            if ((flags & UpdateFlags.AffectsColumnsWidth) == UpdateFlags.AffectsColumnsWidth)
            {
                this.columnWidth.Clear();
            }
        }
예제 #27
0
    /// <summary>
    /// Call commit after changing properties to commit the changes.
    /// This is deffered to a commit call as more than one operation may require rebuilding the buffers, eg. scaling and changing text.
    /// This will be wasteful if performed multiple times.
    /// </summary>
    public void Commit()
    {
        // Make sure instance is set up, might not be when calling from Awake.
        InitInstance();

        // make sure fonts dictionary is initialized properly before proceeding
        _fontInst.InitDictionary();

        // Can come in here without anything initalized when
        // instantiated in code
        if ((updateFlags & UpdateFlags.UpdateBuffers) != 0 || mesh == null)
        {
            Init();
        }
        else
        {
            if ((updateFlags & UpdateFlags.UpdateText) != 0)
            {
                FormatText();
                int target = FillTextData();
                for (int i = target; i < _maxChars; ++i)
                {
                    // was/is unnecessary to fill anything else
                    vertices[i * 4 + 0] = vertices[i * 4 + 1] = vertices[i * 4 + 2] = vertices[i * 4 + 3] = Vector3.zero;
                }

                mesh.vertices = vertices;
                mesh.uv       = uvs;
                if (_fontInst.textureGradients)
                {
                    mesh.uv1 = uv2;
                }

                // comment this in for game if it becomes a problem
                mesh.RecalculateBounds();
            }

            if ((updateFlags & UpdateFlags.UpdateColors) != 0)
            {
                Color topColor    = _color;
                Color bottomColor = _useGradient ? _color2 : _color;

                for (int i = 0; i < colors.Length; i += 4)
                {
                    colors[i + 0] = colors[i + 1] = topColor;
                    colors[i + 2] = colors[i + 3] = bottomColor;
                }
                mesh.colors = colors;
            }
        }

        updateFlags = UpdateFlags.UpdateNone;
    }
예제 #28
0
        public bool Update(string collectionname, IMongoQuery q, IMongoUpdate u, UpdateFlags flag)
        {
            if (server.State == MongoServerState.Disconnected)
            {
                server.Reconnect();
            }

            var collection = database.GetCollection <FrameDLRObject>(collectionname);
            var result     = collection.Update(q, u, flag);

            return(result.Response.GetValue("ok").ToBoolean());
        }
예제 #29
0
 public void ResetValues()
 {
     Radius                = 0.6f;
     Height                = 2.0f;
     MaxAcceleration       = 8.0f;
     MaxSpeed              = 3.5f;
     CollisionQueryRange   = 0.6f * 12.0f;
     PathOptimizationRange = 0.6f * 30.0f;
     UpdateFlags           = 0;
     ObstacleAvoidanceType = 3;
     SeparationWeight      = 2.0f;
     WaitForUpdate         = 0.0f;
 }
예제 #30
0
    // Use this for initialization
    void Awake()
    {
        if (pixelPerfect)
        {
            MakePixelPerfect();
        }

        // force rebuild when awakened, for when the object has been pooled, etc
        // this is probably not the best way to do it
        updateFlags = UpdateFlags.UpdateBuffers;

        Init();
    }
예제 #31
0
 public void ResetValues()
 {
     Radius = 0.6f;
     Height = 2.0f;
     MaxAcceleration = 8.0f;
     MaxSpeed = 3.5f;
     CollisionQueryRange = 0.6f*12.0f;
     PathOptimizationRange = 0.6f*30.0f;
     UpdateFlags = 0;
     ObstacleAvoidanceType = 3;
     SeparationWeight = 2.0f;
     WaitForUpdate = 0.0f;
 }
 internal MongoUpdateMessage(
     MongoConnection connection,
     string collectionFullName,
     UpdateFlags flags,
     IMongoQuery query,
     IMongoUpdate update
 ) :
     base(connection, MessageOpcode.Update) {
     this.collectionFullName = collectionFullName;
     this.flags = flags;
     this.query = query;
     this.update = update;
 }
예제 #33
0
        internal void Update(UpdateFlags flags)
        {
            if ((flags & UpdateFlags.AffectsContent) == UpdateFlags.AffectsContent)
            {
                this.RecycleCells();
                this.RecycleRows();
            }

            if ((flags & UpdateFlags.AffectsColumnsWidth) == UpdateFlags.AffectsColumnsWidth)
            {
                this.RecycleColumns();
            }
        }
예제 #34
0
 protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation,
                                                         UpdateFlags updateFlags)
 {
     if (updateFlags.HasAnyFlag(UpdateFlags.Transport))
     {
         writer.Write(Utility.GetSystemTime());
     }
     if (!updateFlags.HasAnyFlag(UpdateFlags.HasRotation))
     {
         return;
     }
     writer.Write(Rotation);
 }
예제 #35
0
        /// <summary>
        /// Updates a document with the data in doc as found by the selector.
        /// </summary>
        /// <param name="doc">The <see cref="Document"/> to update with
        /// </param>
        /// <param name="selector">
        /// The query spec to find the document to update.
        /// </param>
        /// <param name="flags">
        /// <see cref="UpdateFlags"/>
        /// </param>
        public void Update(Document doc, Document selector, UpdateFlags flags)
        {
            UpdateMessage um = new UpdateMessage();

            um.FullCollectionName = this.FullName;
            um.Selector           = selector;
            um.Document           = doc;
            um.Flags = (int)flags;
            try{
                this.connection.SendMessage(um);
            }catch (IOException ioe) {
                throw new MongoCommException("Could not update document, communication failure", this.connection, ioe);
            }
        }
 internal MongoUpdateMessage(
     MongoServer server,
     string collectionFullName,
     UpdateFlags flags,
     IMongoQuery query,
     IMongoUpdate update
     ) :
     base(server, MessageOpcode.Update)
 {
     this.collectionFullName = collectionFullName;
     this.flags  = flags;
     this.query  = query;
     this.update = update;
 }
 private void Awake()
 {
     this.UpgradeData();
     if (this.data.font != null)
     {
         this._fontInst = this.data.font.inst;
     }
     this.updateFlags = UpdateFlags.UpdateBuffers;
     if (this.data.font != null)
     {
         this.Init();
         this.UpdateMaterial();
     }
     this.updateFlags = UpdateFlags.UpdateNone;
 }
 public UpdateOperation(
     string databaseName,
     string collectionName,
     BsonBinaryReaderSettings readerSettings,
     BsonBinaryWriterSettings writerSettings,
     WriteConcern writeConcern,
     IMongoQuery query,
     IMongoUpdate update,
     UpdateFlags flags,
     bool checkElementNames)
     : base(databaseName, collectionName, readerSettings, writerSettings, writeConcern)
 {
     _query = query;
     _update = update;
     _flags = flags;
     _checkElementNames = checkElementNames;
 }
 // constructors
 internal MongoUpdateMessage(
     BsonBinaryWriterSettings writerSettings,
     string collectionFullName,
     bool checkUpdateDocument,
     UpdateFlags flags,
     int maxDocumentSize,
     IMongoQuery query,
     IMongoUpdate update)
     : base(MessageOpcode.Update, writerSettings)
 {
     _collectionFullName = collectionFullName;
     _checkUpdateDocument = checkUpdateDocument;
     _flags = flags;
     _maxDocumentSize = maxDocumentSize;
     _query = query;
     _update = update;
 }
 // constructors
 /// <summary>
 /// Initializes a new instance of the MongoUpdateOptions class.
 /// </summary>
 public MongoUpdateOptions()
 {
     _checkElementNames = true;
     _flags = UpdateFlags.None;
 }
예제 #41
0
    public void Init()
    {
        if (_font && (updateFlags & UpdateFlags.UpdateBuffers) != 0)
        {
            MeshFilter meshFilter = GetComponent<MeshFilter>();
            Mesh newMesh = new Mesh();

            Color topColor = _color;
            Color bottomColor = _useGradient?_color2:_color;

            // volatile data
            vertices = new Vector3[_maxChars * 4];
            uvs = new Vector2[_maxChars * 4];
            colors = new Color[_maxChars * 4];
            int[] triangles = new int[_maxChars * 6];

            float offsetX, offsetY;
            CalcAnchor(out offsetX, out offsetY);

            float cursorX = 0.0f;
            float cursorY = 0.0f;
            for (int i = 0; i < _maxChars; ++i)
            {
                if (i < _text.Length)
                {
                    int idx = _text[i];
                    if (idx >= _font.chars.Length) idx = 0; // should be space
                    tk2dFontChar chr = _font.chars[idx];

                    if (idx == '\n')
                    {
                        cursorX = 0.0f;
                        cursorY -= _font.lineHeight * _scale.y;
                        continue;
                    }

                    vertices[i * 4 + 0] = new Vector3(offsetX + cursorX + chr.p0.x * _scale.x, offsetY + cursorY + chr.p0.y * _scale.y, 0);
                    vertices[i * 4 + 1] = new Vector3(offsetX + cursorX + chr.p1.x * _scale.x, offsetY + cursorY + chr.p0.y * _scale.y, 0);
                    vertices[i * 4 + 2] = new Vector3(offsetX + cursorX + chr.p0.x * _scale.x, offsetY + cursorY + chr.p1.y * _scale.y, 0);
                    vertices[i * 4 + 3] = new Vector3(offsetX + cursorX + chr.p1.x * _scale.x, offsetY + cursorY + chr.p1.y * _scale.y, 0);

                    uvs[i * 4 + 0] = new Vector2(chr.uv0.x, chr.uv0.y);
                    uvs[i * 4 + 1] = new Vector2(chr.uv1.x, chr.uv0.y);
                    uvs[i * 4 + 2] = new Vector2(chr.uv0.x, chr.uv1.y);
                    uvs[i * 4 + 3] = new Vector2(chr.uv1.x, chr.uv1.y);

                    cursorX += chr.advance * _scale.x;
                }
                else
                {
                    vertices[i * 4 + 0] = vertices[i * 4 + 1] = vertices[i * 4 + 2] = vertices[i * 4 + 3] = Vector3.zero;
                    uvs[i * 4 + 0] = uvs[i * 4 + 1] = uvs[i * 4 + 2] = uvs[i * 4 + 3] = Vector2.zero;
                }

                colors[i * 4 + 0] = colors[i * 4 + 1] = topColor;
                colors[i * 4 + 2] = colors[i * 4 + 3] = bottomColor;

                triangles[i * 6 + 0] = i * 4 + 0;
                triangles[i * 6 + 1] = i * 4 + 1;
                triangles[i * 6 + 2] = i * 4 + 3;
                triangles[i * 6 + 3] = i * 4 + 2;
                triangles[i * 6 + 4] = i * 4 + 0;
                triangles[i * 6 + 5] = i * 4 + 3;

                if (_kerning && i < _text.Length - 1)
                {
                    foreach (var k in _font.kerning)
                    {
                        if (k.c0 == _text[i] && k.c1 == _text[i+1])
                        {
                            cursorX += k.amount * _scale.x;
                            break;
                        }
                    }
                }
            }

            newMesh.vertices = vertices;
            newMesh.uv = uvs;
            newMesh.triangles = triangles;
            newMesh.colors = colors;

            newMesh.RecalculateBounds();
            meshFilter.mesh = newMesh;
            mesh = meshFilter.sharedMesh;

            updateFlags = UpdateFlags.UpdateNone;
        }
    }
예제 #42
0
 public WriteConcernResult Update(IMongoQuery query, IMongoUpdate update, UpdateFlags flags, WriteConcern writeConcern, bool needResult)
 {
     return _this.Update(query, update, flags, writeConcern);
 }
 // constructors
 /// <summary>
 /// Initializes a new instance of the MongoUpdateOptions class.
 /// </summary>
 public MongoUpdateOptions()
 {
     _flags = UpdateFlags.None;
 }
예제 #44
0
	void SetNeedUpdate(UpdateFlags uf) {
		if (updateFlags == UpdateFlags.UpdateNone) {
			updateFlags |= uf;
			tk2dUpdateManager.QueueCommit(this);
		}
		else {
			// Already queued
			updateFlags |= uf;
		}
	}
예제 #45
0
    public void Init()
    {
        if (_font && ((updateFlags & UpdateFlags.UpdateBuffers) != 0 || mesh == null))
        {
            _font.InitDictionary();

            Color topColor = _color;
            Color bottomColor = _useGradient?_color2:_color;

            // volatile data
            vertices = new Vector3[_maxChars * 4];
            uvs = new Vector2[_maxChars * 4];
            colors = new Color[_maxChars * 4];
            if (_font.textureGradients)
            {
                uv2 = new Vector2[_maxChars * 4];
            }
            int[] triangles = new int[_maxChars * 6];
            int target = FillTextData();

            for (int i = 0; i < target; ++i)
            {
                colors[i * 4 + 0] = colors[i * 4 + 1] = topColor;
                colors[i * 4 + 2] = colors[i * 4 + 3] = bottomColor;

                triangles[i * 6 + 0] = i * 4 + 0;
                triangles[i * 6 + 1] = i * 4 + 1;
                triangles[i * 6 + 2] = i * 4 + 3;
                triangles[i * 6 + 3] = i * 4 + 2;
                triangles[i * 6 + 4] = i * 4 + 0;
                triangles[i * 6 + 5] = i * 4 + 3;
            }

            for (int i = target; i < _maxChars; ++i)
            {
                vertices[i * 4 + 0] = vertices[i * 4 + 1] = vertices[i * 4 + 2] = vertices[i * 4 + 3] = Vector3.zero;
                uvs[i * 4 + 0] = uvs[i * 4 + 1] = uvs[i * 4 + 2] = uvs[i * 4 + 3] = Vector2.zero;
                if (_font.textureGradients)
                {
                    uv2[i * 4 + 0] = uv2[i * 4 + 1] = uv2[i * 4 + 2] = uv2[i * 4 + 3] = Vector2.zero;
                }

                colors[i * 4 + 0] = colors[i * 4 + 1] = topColor;
                colors[i * 4 + 2] = colors[i * 4 + 3] = bottomColor;

                triangles[i * 6 + 0] = i * 4 + 0;
                triangles[i * 6 + 1] = i * 4 + 1;
                triangles[i * 6 + 2] = i * 4 + 3;
                triangles[i * 6 + 3] = i * 4 + 2;
                triangles[i * 6 + 4] = i * 4 + 0;
                triangles[i * 6 + 5] = i * 4 + 3;
            }

            if (mesh == null)
            {
                if (meshFilter == null)
                    meshFilter = GetComponent<MeshFilter>();

                mesh = new Mesh();
                meshFilter.mesh = mesh;
            }
            else
            {
                mesh.Clear();
            }
            mesh.vertices = vertices;
            mesh.uv = uvs;
            if (font.textureGradients)
            {
                mesh.uv1 = uv2;
            }
            mesh.triangles = triangles;
            mesh.colors = colors;
            mesh.RecalculateBounds();

            updateFlags = UpdateFlags.UpdateNone;
        }
    }
 // constructors
 /// <summary>
 /// Initializes a new instance of the MongoUpdateOptions class.
 /// </summary>
 public MongoUpdateOptions()
 {
     this.checkElementNames = true;
     this.flags = UpdateFlags.None;
 }
예제 #47
0
    // Use this for initialization
    void Awake()
    {
        UpgradeData();
        if (data.font != null)
            _fontInst = data.font.inst;

        // force rebuild when awakened, for when the object has been pooled, etc
        // this is probably not the best way to do it
        updateFlags = UpdateFlags.UpdateBuffers;

        if (data.font != null)
        {
            Init();
            UpdateMaterial();
        }
    }
예제 #48
0
 protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
 {
     // Probably specific to Unit
     if (updateFlags.HasFlag(UpdateFlags.AttackingTarget))
     {
         writer.Write((byte)0); // pguid
     }
 }
예제 #49
0
	public void Init()
	{
		if (_fontInst && ((updateFlags & UpdateFlags.UpdateBuffers) != 0 || mesh == null))
		{
			_fontInst.InitDictionary();
			FormatText();

			var geomData = tk2dTextGeomGen.Data( data, _fontInst, _formattedText );

			// volatile data
			int numVertices;
			int numIndices;
			tk2dTextGeomGen.GetTextMeshGeomDesc(out numVertices, out numIndices, geomData);
			vertices = new Vector3[numVertices];
			uvs = new Vector2[numVertices];
			colors = new Color32[numVertices];
			untintedColors = new Color32[numVertices];
			if (_fontInst.textureGradients)
			{
				uv2 = new Vector2[numVertices];
			}
			int[] triangles = new int[numIndices];


			int target = tk2dTextGeomGen.SetTextMeshGeom(vertices, uvs, uv2, untintedColors, 0, geomData);

			if (!_fontInst.isPacked) {
				Color32 topColor = data.color;
				Color32 bottomColor = data.useGradient ? data.color2 : data.color;
				for (int i = 0; i < numVertices; ++i) {
					Color32 c = ((i % 4) < 2) ? topColor : bottomColor;
					byte red = (byte)(((int)untintedColors[i].r * (int)c.r) / 255);
					byte green = (byte)(((int)untintedColors[i].g * (int)c.g) / 255);
					byte blue = (byte)(((int)untintedColors[i].b * (int)c.b) / 255);
					byte alpha = (byte)(((int)untintedColors[i].a * (int)c.a) / 255);
					if (_fontInst.premultipliedAlpha) {
						red = (byte)(((int)red * (int)alpha) / 255);
						green = (byte)(((int)green * (int)alpha) / 255);
						blue = (byte)(((int)blue * (int)alpha) / 255);
					}
					colors[i] = new Color32(red, green, blue, alpha);
				}
			}
			else {
				colors = untintedColors;
			}

			tk2dTextGeomGen.SetTextMeshIndices(triangles, 0, 0, geomData, target);
			


			if (mesh == null)
			{
				if (meshFilter == null)
					meshFilter = GetComponent<MeshFilter>();
				
				mesh = new Mesh();
				mesh.hideFlags = HideFlags.DontSave;
				meshFilter.mesh = mesh;
			}
			else
			{
				mesh.Clear();
			}
			mesh.vertices = vertices;
			mesh.uv = uvs;
			if (font.textureGradients)
			{
				mesh.uv2 = uv2;
			}
			mesh.triangles = triangles;
			mesh.colors32 = colors;
			mesh.RecalculateBounds();
			mesh.bounds = tk2dBaseSprite.AdjustedMeshBounds( mesh.bounds, data.renderLayer );

			updateFlags = UpdateFlags.UpdateNone;
		}
	}
예제 #50
0
 protected virtual void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
 {
 }
예제 #51
0
    /// <summary>
    /// Call commit after changing properties to commit the changes.
    /// This is deffered to a commit call as more than one operation may require rebuilding the buffers, eg. scaling and changing text.
    /// This will be wasteful if performed multiple times.
    /// </summary>
    public void Commit()
    {
        // make sure fonts dictionary is initialized properly before proceeding
        _font.InitDictionary();

        // Can come in here without anything initalized when
        // instantiated in code
        if ((updateFlags & UpdateFlags.UpdateBuffers) != 0 || mesh == null)
        {
            Init();
        }
        else
        {
            if ((updateFlags & UpdateFlags.UpdateText) != 0)
            {
                int target = FillTextData();
                for (int i = target; i < _maxChars; ++i)
                {
                    // was/is unnecessary to fill anything else
                    vertices[i * 4 + 0] = vertices[i * 4 + 1] = vertices[i * 4 + 2] = vertices[i * 4 + 3] = Vector3.zero;
                }

                mesh.vertices = vertices;
                mesh.uv = uvs;
                if (font.textureGradients)
                {
                    mesh.uv1 = uv2;
                }

                // comment this in for game if it becomes a problem
        #if UNITY_EDITOR
                mesh.RecalculateBounds();
        #endif
            }

            if ((updateFlags & UpdateFlags.UpdateColors) != 0)
            {
                Color topColor = _color;
                Color bottomColor = _useGradient ? _color2 : _color;

                for (int i = 0; i < colors.Length; i += 4)
                {
                    colors[i + 0] = colors[i + 1] = topColor;
                    colors[i + 2] = colors[i + 3] = bottomColor;
                }
                mesh.colors = colors;
            }
        }

        updateFlags = UpdateFlags.UpdateNone;
    }
예제 #52
0
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 void LateUpdate()
 {
     if ( updateFlags != UpdateFlags.None ) {
         InternalUpdate();
         updateFlags = UpdateFlags.None;
     }
 }
예제 #53
0
 public void Init(bool force)
 {
     if (force)
     {
         updateFlags |= UpdateFlags.UpdateBuffers;
     }
     Init();
 }
예제 #54
0
파일: GameObject.cs 프로젝트: ray2006/WCell
		protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
		{
			// Will only be GameObjects
			if (updateFlags.HasAnyFlag(UpdateFlags.Transport))
			{
				writer.Write(Utility.GetSystemTime());
			}
			if (updateFlags.HasAnyFlag(UpdateFlags.HasRotation))
			{
				writer.Write(Rotation);
			}
		}
예제 #55
0
    // Use this for initialization
    void Awake()
    {
        if (pixelPerfect)
            MakePixelPerfect();

        // force rebuild when awakened, for when the object has been pooled, etc
        // this is probably not the best way to do it
        updateFlags = UpdateFlags.UpdateBuffers;

        Init();
    }
예제 #56
0
파일: Vehicle.cs 프로젝트: NVN/WCell
		protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
		{
			base.WriteTypeSpecificMovementUpdate(writer, relation, updateFlags);
			writer.Write(m_entry.VehicleId);
			writer.Write(m_entry.VehicleAimAdjustment);
		}
예제 #57
0
	// Use this for initialization
	void Awake() 
	{
		UpgradeData();
		if (data.font != null)
			_fontInst = data.font.inst;

		// force rebuild when awakened, for when the object has been pooled, etc
		// this is probably not the best way to do it
		updateFlags = UpdateFlags.UpdateBuffers;
		
		if (data.font != null)
		{
			Init();
			UpdateMaterial();
		}

		// Sensibly reset, so tk2dUpdateManager can deal with this properly
		updateFlags = UpdateFlags.UpdateNone;
	}
예제 #58
0
 public void Update(Document doc, Document selector, UpdateFlags flags)
 {
     UpdateMessage um = new UpdateMessage();
     um.FullCollectionName = this.FullName;
     um.Selector = selector;
     um.Document = doc;
     um.Flags = (int)flags;
     try{
         this.connection.SendMessage(um);
     }catch(IOException ioe){
         throw new MongoCommException("Could not update document, communication failure", this.connection,ioe);
     }
 }
예제 #59
0
	// Do not call this, its meant fo internal use
	public void DoNotUse__CommitInternal()
	{
		// Make sure instance is set up, might not be when calling from Awake.
		InitInstance();

		// make sure fonts dictionary is initialized properly before proceeding
		if (_fontInst == null) {
			return;
		}
		_fontInst.InitDictionary();
		
		// Can come in here without anything initalized when
		// instantiated in code
		if ((updateFlags & UpdateFlags.UpdateBuffers) != 0 || mesh == null)
		{
			Init();
		}
		else 
		{
			if ((updateFlags & UpdateFlags.UpdateText) != 0)
			{
				FormatText();

				var geomData = tk2dTextGeomGen.Data( data, _fontInst, _formattedText );
				int target = tk2dTextGeomGen.SetTextMeshGeom(vertices, uvs, uv2, untintedColors, 0, geomData);

				for (int i = target; i < data.maxChars; ++i)
				{
					// was/is unnecessary to fill anything else
					vertices[i * 4 + 0] = vertices[i * 4 + 1] = vertices[i * 4 + 2] = vertices[i * 4 + 3] = Vector3.zero;
				}
	
				mesh.vertices = vertices;
				mesh.uv = uvs;
				if (_fontInst.textureGradients)
				{
					mesh.uv2 = uv2;
				}
				if (_fontInst.isPacked) {
					colors = untintedColors;
					mesh.colors32 = colors;
				}
				if (data.inlineStyling) {
					SetNeedUpdate(UpdateFlags.UpdateColors);
				}

				mesh.RecalculateBounds();
				mesh.bounds = tk2dBaseSprite.AdjustedMeshBounds( mesh.bounds, data.renderLayer );
			}
	
			if (!font.isPacked && (updateFlags & UpdateFlags.UpdateColors) != 0) // packed fonts don't support tinting
			{
				Color32 topColor = data.color;
				Color32 bottomColor = data.useGradient ? data.color2 : data.color;
				for (int i = 0; i < colors.Length; ++i) {
					Color32 c = ((i % 4) < 2) ? topColor : bottomColor;
					byte red = (byte)(((int)untintedColors[i].r * (int)c.r) / 255);
					byte green = (byte)(((int)untintedColors[i].g * (int)c.g) / 255);
					byte blue = (byte)(((int)untintedColors[i].b * (int)c.b) / 255);
					byte alpha = (byte)(((int)untintedColors[i].a * (int)c.a) / 255);
					if (_fontInst.premultipliedAlpha) {
						red = (byte)(((int)red * (int)alpha) / 255);
						green = (byte)(((int)green * (int)alpha) / 255);
						blue = (byte)(((int)blue * (int)alpha) / 255);
					}
					colors[i] = new Color32(red, green, blue, alpha);
				}

				mesh.colors32 = colors;
			}
		}
		
		updateFlags = UpdateFlags.UpdateNone;
	}
예제 #60
0
파일: LLPrimitive.cs 프로젝트: thoys/simian
 public static bool HasFlag(this UpdateFlags updateFlags, UpdateFlags flag)
 {
     return (updateFlags & flag) == flag;
 }