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); }
internal void RegisterUpdate(UpdateFlags flags) { if (this.Owner != null) { this.Owner.updateService.RegisterUpdate((int)flags); } }
internal void Update(UpdateFlags flags) { if ((flags & UpdateFlags.AffectsDecorations) == UpdateFlags.AffectsDecorations) { this.RecycleAllDecorators(); } }
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; }
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)); }
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(); }
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); }
void RebuildAll() { UpdateMaterial(); updateFlags = UpdateFlags.UpdateNone; SetNeedUpdate(UpdateFlags.UpdateAll); }
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(); } }
public void MarkForUpdate(UpdateFlags flag, IGTFGraphElementModel model = null) { EditorDataModel?.SetUpdateFlag(flag); if (model != null) { EditorDataModel?.AddModelToUpdate(model); } }
public MovementBlock(UpdateBlock update) { Update = update; UpdateFlags = (UpdateFlags)update.ReadUShort(); ObjectTypeId = update.ObjectType; this.Parse(); }
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; }
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); }
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); }
protected override void BeginProcessing() { if (_Update == null) throw new PSArgumentException(_UpdateError ?? TextParameterUpdate); //_131102_111738 if (Add) _Flags |= UpdateFlags.Upsert; if (All) _Flags |= UpdateFlags.Multi; }
void SetNeedUpdate(UpdateFlags uf) { if (updateFlags == UpdateFlags.UpdateNone) { updateFlags |= uf; tk2dUpdateManager.QueueCommit(this); } else { // Already queued updateFlags |= uf; } }
internal void OnProperyChange(UpdateFlags flags) { if (this.Model != null) { var update = new Update <UpdateFlags> { Sender = this, Flags = flags }; this.Model.GridView.UpdateService.RegisterUpdate(update); } }
/// <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; } }
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); } }
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)); }
internal void Update(UpdateFlags flags) { if ((flags & UpdateFlags.AffectsContent) == UpdateFlags.AffectsContent) { this.FullyRecycle(); } if ((flags & UpdateFlags.AffectsColumnsWidth) == UpdateFlags.AffectsColumnsWidth) { this.columnWidth.Clear(); } }
/// <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; }
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()); }
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; }
// 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(); }
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; }
internal void Update(UpdateFlags flags) { if ((flags & UpdateFlags.AffectsContent) == UpdateFlags.AffectsContent) { this.RecycleCells(); this.RecycleRows(); } if ((flags & UpdateFlags.AffectsColumnsWidth) == UpdateFlags.AffectsColumnsWidth) { this.RecycleColumns(); } }
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); }
/// <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; }
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; } }
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; }
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; }
// 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(); } }
protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags) { // Probably specific to Unit if (updateFlags.HasFlag(UpdateFlags.AttackingTarget)) { writer.Write((byte)0); // pguid } }
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; } }
protected virtual void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags) { }
/// <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; }
// ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ void LateUpdate() { if ( updateFlags != UpdateFlags.None ) { InternalUpdate(); updateFlags = UpdateFlags.None; } }
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); } }
// 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(); }
// 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; }
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); } }
// 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; }
public static bool HasFlag(this UpdateFlags updateFlags, UpdateFlags flag) { return (updateFlags & flag) == flag; }