//Called by logic core after eval actions //Called by pcobj on start public void ReportGridState(int p) { Debug.Log("Reporting Grid states to player '" + p + "'"); CellStruct[][,] state = this.PB.GetPlayerGameState(p, false); CellStruct[] pOwnGrid = GUtils.Serialize(state[0]); CellStruct[] pOtherGrid = GUtils.Serialize(state[1]); List <ActionAvail> aaList = this.PB.GetActionAvailable(p); int[] factionProgress = this.PB.GetFactionProgress(p).GetArray(); Vector2 [] capitolLocs = this.PB.capitolTowerLocs[p].ToArray(); int[] gridSize = new int[] { sizex, sizey }; bool hitSunk = this.PB.hitSunk[p]; // Player's last actions sunk one or more enemy ships ActionReq[] lastActions = this.PB.GetLastActions(p).ToArray(); GameBoardInfo gbi = new GameBoardInfo(pOwnGrid, pOtherGrid, gridSize, aaList.ToArray(), factionProgress, capitolLocs, hitSunk, lastActions); this.mnm.playerSlots[p].RpcUpdatePlayBoard(gbi); }
public void RpcUpdatePlayBoard(GameBoardInfo gbi) { if (!isLocalPlayer || !this.ReadyGuard()) // Ignore info if not local or Start not called yet { return; } Debug.Log("Player: " + this.playerId + " got Playboard update"); //Debug.Log("Ours: " + our.Length.ToString() + " :: Theirs: " + other.Length.ToString()); //Debug.Log("Got AA list: " + gbi.aaArray.Count().ToString()); this.latestCapitolLocs = gbi.capitolTowers.ToList(); UIController.instance.ActionSelectButtonGrpActionAvailUpdate(gbi.aaArray.ToList()); UIController.instance.ActionSelectGroupUpdateActionInfo(gbi.aaArray.ToList()); this.latestPlayerGrid = GUtils.Deserialize(gbi.ourGrid, gbi.gridSize[0], gbi.gridSize[1]); this.latestEnemyGrid = GUtils.Deserialize(gbi.theirGrid, gbi.gridSize[0], gbi.gridSize[1]); UIController.instance.ActionSelectGroupUpdateFactionProgress(new FactionProgress(gbi.factionProgress), this.latestPlayerGrid, this.latestEnemyGrid); if (gbi.hitSunk) { UIController.instance.HitSunkDisplayFlash(); } this.pb.UpdateBoardFancy(gbi.lastArs.ToList(), this.latestPlayerGrid, this.latestEnemyGrid); }