private static void setColor(Character character, int i, int j) { if (j + (i * 40) >= 7 && j + (i * 40) <= 11) { character.Color = Color.Red; } else if (j + (i * 40) >= 20 && j + (i * 40) <= 23) { character.Color = Color.Orange; } else if (j + (i * 40) >= 33 && j + (i * 40) <= 37) { character.Color = Color.Yellow; } else if (j + (i * 40) >= 47 && j + (i * 40) <= 52) { character.Color = Color.Green; } else if (j + (i * 40) >= 55 && j + (i * 40) <= 65) { character.Color = Color.Blue; } else if (j + (i * 40) >= 71 && j + (i * 40) <= 74) { character.Color = Color.Indigo; } else if (j + (i * 40) >= 92 && j + (i * 40) <= 97) { character.Color = Color.Violet; } else { character.Color = Color.Black; } }
public Character GetCharacter(char c) { if (_character == null || !_character.ContainsKey(c)) { //新建对象 //string name = "FlyWeight.Busness" + "." + // "Character" + c.ToString(); //character = Activator.CreateInstance( // Type.GetType(name)) as Character; Character character = new Character(c); _character.Add(c, character); } return _character[c]; }