private void InnerOnVertexPropertyChange(HUDGraphic item) { int index = -1; int per_quad_index = -1; if (item.build_data_index < 0) { return; } index = item.build_data_index; tmp_job_data = buffer_info.transform_job_datas[index]; tmp_job_data.flag |= DirtyFlag.EQuad; per_quad_index = tmp_job_data.per_quad_index; int count = math.min(item.uv0_rect.Length, buffer_info.info.quad_count); count = math.min(count, item.valid_quad); for (int i = 0; i < count; ++i) { int offset = per_quad_index + i; tmp_quad_data.uv0 = item.uv0_rect[i]; tmp_quad_data.tparams = item.tparams[i]; tmp_quad_data.color = item.color; tmp_quad_data.size = item.sizes[i]; buffer_info.quad_job_datas[offset] = tmp_quad_data; } buffer_info.transform_job_datas[index] = tmp_job_data; AddIndexToDirty(index); }
public void PushOperation(HUDGraphic graphic, OperationType opt) { OperationType current; if (need_rebuild_graphics.TryGetValue(graphic, out current)) { if (CheckOpt(opt, OperationType.Add)) { current &= ~OperationType.Remove; } if (CheckOpt(current, OperationType.Remove)) { current &= ~OperationType.Add; } if (CheckOpt(opt, OperationType.Active)) { current &= ~OperationType.DeActive; } if (CheckOpt(current, OperationType.DeActive)) { current &= ~OperationType.Active; } current |= opt; need_rebuild_graphics[graphic] = current; } else { need_rebuild_graphics.Add(graphic, opt); } }
public void OnVertexPropertyChange(HUDGraphic item) { var operation = new Operation() { opt = OperationType.VertexProperty, item = item }; operator_queue.Enqueue(operation); }
public void OnItemTransformChange(HUDGraphic item) { var operation = new Operation() { opt = OperationType.TransformChange, item = item }; operator_queue.Enqueue(operation); }
protected void AttachGraphic(HUDGraphic graphic) { if (self_graphics.Contains(graphic)) { return; } self_graphics.AddLast(graphic); }
public void RemoveGraphic(HUDGraphic graphic) { if (graphic.batch == null) { return; } graphic.batch.PushOperation(graphic, HUDBatch.OperationType.Remove); RegisterHUDGroupRebuildMesh(graphic.group); }
private void InnerAddItem(HUDGraphic item) { int index = -1; int per_quad_index = -1; if (item.build_data_index < 0) { if (!CheckBufferOverFlow()) { return; } var data_index = buffer_info.Add(); index = data_index.x; per_quad_index = data_index.y; item_dic.Add(index, item); } else { index = item.build_data_index; per_quad_index = buffer_info.transform_job_datas[index].per_quad_index; } item.build_data_index = index; item.batch = this; tmp_job_data.index = index; tmp_job_data.is_active = (byte)1; tmp_job_data.per_quad_index = per_quad_index; tmp_job_data.is_text = item.is_text ? (byte)1 : (byte)0; tmp_job_data.spacing = item.spacing; tmp_job_data.local_position = item.local_position; tmp_job_data.local_scale = item.local_scale; tmp_job_data.gscale = item.gscale; tmp_job_data.valid_quad = item.valid_quad; tmp_job_data.extend.x = (half)item.progress_value; tmp_job_data.flag = DirtyFlag.ETransform | DirtyFlag.EQuad; int count = math.min(item.uv0_rect.Length, buffer_info.info.quad_count); count = math.min(count, item.valid_quad); for (int i = 0; i < count; ++i) { int offset = per_quad_index + i; tmp_quad_data.uv0 = item.uv0_rect[i]; tmp_quad_data.tparams = item.tparams[i]; tmp_quad_data.color = item.color; tmp_quad_data.size = item.sizes[i]; buffer_info.quad_job_datas[offset] = tmp_quad_data; } buffer_info.transform_job_datas[index] = tmp_job_data; AddIndexToDirty(index); }
private void InnerDeActive(HUDGraphic item) { int index = -1; if (item.build_data_index < 0) { return; } index = item.build_data_index; tmp_job_data = buffer_info.transform_job_datas[index]; tmp_job_data.is_active = (byte)0; }
private void InnerRemoveItem(HUDGraphic item) { if (item.build_data_index < 0) { return; } int last = buffer_info.Length - 1; HUDGraphic last_item = item_dic[last]; int index = item.build_data_index; buffer_info.RemoveSwapAtBack(index); item_dic[index] = last_item; last_item.build_data_index = index; item_dic.Remove(last); item.build_data_index = -1; item.batch = null; }
public void RebuildGraphic(HUDGraphic graphic, DirtyFlag flag) { if (graphic.batch == null) { return; } switch (flag) { case DirtyFlag.ETransform: graphic.batch.PushOperation(graphic, HUDBatch.OperationType.TransformChange); break; case DirtyFlag.EQuad: graphic.batch.PushOperation(graphic, HUDBatch.OperationType.VertexProperty); break; } RegisterHUDGroupRebuildMesh(graphic.group); }
public void AddGraphic(HUDGraphic graphic) { if (graphic.batch != null) { return; } if (graphic.size == EGraphicSize.ESmall) { graphic.batch = sprite_batch; } else if (graphic.size == EGraphicSize.ELarge) { graphic.batch = text_batch; } graphic.batch.PushOperation(graphic, HUDBatch.OperationType.Add); RegisterHUDGroupRebuildMesh(graphic.group); }
private void InnerOnItemTransformChange(HUDGraphic item) { int index = -1; if (item.build_data_index < 0) { return; } index = item.build_data_index; tmp_job_data = buffer_info.transform_job_datas[index]; tmp_job_data.spacing = item.spacing; tmp_job_data.local_position = item.local_position; tmp_job_data.local_scale = item.local_scale; tmp_job_data.gscale = item.gscale; tmp_job_data.valid_quad = item.valid_quad; tmp_job_data.extend.x = (half)item.progress_value; tmp_job_data.flag |= DirtyFlag.ETransform; buffer_info.transform_job_datas[index] = tmp_job_data; AddIndexToDirty(index); }
public void DeActiveGraphic(HUDGraphic graphic) { RemoveGraphic(graphic); }
public void ActiveGraphic(HUDGraphic graphic) { AddGraphic(graphic); }