private void fillWithTestTeams(Dictionary <String, TeamLineup> lineups, int count) { for (int i = 1; i <= count; i++) { String teamName = "MyTeam" + i; TeamLineup lineup = new TeamLineup(); LineupData lupLeft = new LineupData(RecordIndex.getNextId(RecordIndex.INDEX.TestLineupDataId), "L", new LineupBalanceItem(0, 9, "L"), new LineupBalanceItem(18, 9, "R"), 77); lineup.Lineups.Add(lupLeft); List <Player> players = new List <Player>(); String[] names = { "CatcherL1", "FirstL1", "SecondL1", "ThirdL1", "ShortstopL1", "LeftL1", "CenterL1", "RightL1", "DesignatedL1" }; foreach (String name in names) { players.Add(createTestPlayer(name)); } LineupData lupRight = new LineupData(RecordIndex.getNextId(RecordIndex.INDEX.TestLineupDataId), "R", new LineupBalanceItem(0, 9, "L"), new LineupBalanceItem(18, 9, "R"), 888); lineup.Lineups.Add(lupRight); String[] namesR = { "CatcherR1", "FirstR1", "SecondR1", "ThirdR1", "ShortstopR1", "LeftR1", "CenterR1", "RightR1", "DesignatedR1" }; foreach (String name in namesR) { players.Add(createTestPlayer(name)); } lineup.playerByGRID = players; lineups.Add(teamName, lineup); } }
private int lookupEstimatedAtBatForLineup(List <Dictionary <int, int> > results, LineupDataObj lineup) { int pitcherArmIndex = lineup.PitcherArm.Equals("L") ? 0 : 1; LineupData data = lineup.getLineupData(); int estimatedAtBats = SOMTeamReportFile.calculateAtBatsByLineup(results[pitcherArmIndex], data); return(estimatedAtBats); }
/// <summary> /// 构造函数 /// </summary> /// <param name="data"></param> public LineupBase(LineupData data_) { //转存阵形数据 this.data = data_; //生成阵形 init(data_); }
/// <summary> /// 生成阵形 /// </summary> /// <param name="data_"></param> public override void init(LineupData data_) { //生成圆形坐标 for (int i = 0; i < 12; i++) { _room.Add(new Vector3( data_.point.x + data_.room[0] * Mathf.Cos(360 / 12 * i * 3.14f / 180), data_.point.y, data_.point.z + data_.room[0] * Mathf.Sin(360 / 12 * i * 3.14f / 180))); } }
/// <summary> /// 初始化 /// </summary> public override void init(LineupData data_) { //生成矩阵的坐标 for (int i = 0; i < data_.room[3]; i++) { for (int j = 0; j < data_.room[4]; j++) { _room.Add(new Vector3( data_.room[1] * i + data_.point.x, data_.point.y, data_.room[2] * j + data_.point.z)); } } }
// Use this for initialization void Start() { //士兵 for (int i = 0; i < 12; i++) { soldiers.Add(ResourceManager.getInstance().getGameObject("A_JS_RenLei_A_001")); } //一字 data1 = new LineupData(); data1.point = new Vector3(0, 0, 0); data1.room = new int[5] { 1, 1, 1, 12, 1 }; lineup1 = new RectangleLineup(data1); //长方形 data2 = new LineupData(); data2.point = new Vector3(0, 0, 0); data2.room = new int[5] { 1, 1, 1, 3, 4 }; lineup2 = new RectangleLineup(data2); //圆形 data3 = new LineupData(); data3.point = new Vector3(0, 0, 0); data3.room = new int[2] { 2, 5 }; lineup3 = new RoundLineup(data3); //三角形 data4 = new LineupData(); data4.point = new Vector3(0, 0, 0); data4.room = new int[2] { 1, 12 }; lineup4 = new TriangleLineup(data4); //正方形 data5 = new LineupData(); data5.point = new Vector3(0, 0, 0); data5.room = new int[5] { 1, 1, 1, 4, 4 }; lineup5 = new RectangleLineup(data5); }
private int calculateAtBatsByLineup(Dictionary <int, int> stats, LineupData lineup) { if (stats.Count == 0) { return(0); } int fromLevel = lineup.BalanceItemFrom.Value; int toLevel = lineup.BalanceItemTo.Value; int totalAtBats = 0; for (int i = fromLevel; i <= toLevel; i++) { totalAtBats += stats[i]; } return(totalAtBats); }
// Use this for initialization void Start() { //士兵 for (int i = 0; i < 12; i++) { soldiers.Add(ResourceManager.getInstance().getGameObject("A_JS_RenLei_A_001")); } //一字 data1 = new LineupData(); data1.point = new Vector3(0, 0, 0); data1.room = new int[5]{1,1,1,12,1}; lineup1 = new RectangleLineup(data1); //长方形 data2 = new LineupData(); data2.point = new Vector3(0, 0, 0); data2.room = new int[5] { 1, 1, 1, 3, 4 }; lineup2 = new RectangleLineup(data2); //圆形 data3 = new LineupData(); data3.point = new Vector3(0, 0, 0); data3.room = new int[2] { 2,5}; lineup3 = new RoundLineup(data3); //三角形 data4 = new LineupData(); data4.point = new Vector3(0, 0, 0); data4.room = new int[2] {1, 12}; lineup4 = new TriangleLineup(data4); //正方形 data5 = new LineupData(); data5.point = new Vector3(0, 0, 0); data5.room = new int[5] { 1, 1, 1, 4, 4 }; lineup5 = new RectangleLineup(data5); }
/// <summary> /// 生成阵形 /// </summary> /// <param name="data_"></param> public override void init(LineupData data_) { //边长 float side = 0; //依次添加每行的其他坐标 int num = 0; for (int i = 0; i < data_.room[1]; i++) { //取半个边长 side = data_.room[0] * i / Mathf.Tan(45); //取每一行最左侧的点的坐标 float left = data_.point.x - side; //间隔 float spacing = side * 2 / i; for (int j = 0; j <= i; j++) { //添加顶点 if (i == 0 && j == 0) { _room.Add(data_.point); } else { //从最左侧坐标依次增加固定长度 _room.Add(new Vector3(left + spacing * j, data_.point.y, data_.point.z + data_.room[0] * i)); } num++; if (num >= data_.room[1]) { return; } } } }
/// <summary> /// 构造函数 /// </summary> /// <param name="data_"></param> public TriangleLineup(LineupData data_) : base(data_) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="data"></param> public RectangleLineup(LineupData data_) : base(data_) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="data_"></param> public RoundLineup(LineupData data_) : base(data_) { }
/// <summary> /// 初始化,主要初始化阵形数据。由子类实现 /// </summary> /// <param name="data"></param> /// <param name="point"></param> public abstract void init(LineupData data);