public override void PerformAction() { ColorChangeInfo valueChangeAction = new ColorChangeInfo(); valueChangeAction.newColor = color; GameEventSystem.DoEvent( thisEvent_Type, valueChangeAction ); }
void ProcessText(string text, int text_idx_delta, List <ColorChangeInfo> colore_changes, ref ColorTable color_table, StringBuilder rtf) { int text_idx = -text_idx_delta; int text_len = text.Length - text_idx_delta; #if DEBUG int last_info_text_idx = -text_idx_delta - 1; #endif int prev_color = -1; int prev_back_color = -1; for (int i = 0, e = colore_changes.Count; i < e; ++i) { ColorChangeInfo info = colore_changes[i]; #if DEBUG Debug.Assert(i == e - 1 || info.fore_color_index >= 0 || info.back_color_index >= 0); Debug.Assert(info.text_index > last_info_text_idx); last_info_text_idx = info.text_index; #endif if (info.text_index >= text_len) { break; } if ((info.fore_color_index < 0 || info.fore_color_index == prev_color) && (info.back_color_index < 0 || info.back_color_index == prev_back_color)) { continue; } AppendEscapedText(text, text_idx + text_idx_delta, info.text_index + text_idx_delta, rtf); text_idx = info.text_index; if (info.fore_color_index >= 0 && info.fore_color_index != prev_color) { rtf.Append(color_table.fore_color_escapes[info.fore_color_index]); prev_color = info.fore_color_index; } if (info.back_color_index >= 0 && info.back_color_index != prev_back_color) { rtf.Append(color_table.back_color_escapes[info.back_color_index]); prev_back_color = info.back_color_index; } } AppendEscapedText(text, text_idx + text_idx_delta, text_len + text_idx_delta, rtf); }
void changeColor(EventInfo info) { ColorChangeInfo colorChangeInfo = (ColorChangeInfo)info; gameObject.GetComponent <Renderer>().material.color = colorChangeInfo.newColor; }