public void CheckOOB() { foreach (OOBResponse item in oobJson) { Debug.Log("Board Load ID: " + item.boardLoadId); if (!seenMessages.Contains(item.messageid)) { seenMessages.Add(item.messageid); if (item.boardLoadId != null) { Debug.Log("Got OOB Board load."); Debug.Log(ModdingUtils.LoadBoard(item.boardLoadId)); continue; } SystemMessage.DisplayInfoText(item.handoutUrl, 2.5f); StartCoroutine(DownloadImage(item.handoutUrl)); } } oobJson = new OOBResponse[] { }; //ModdingUtils.SendOOBMessage("{\"sessionid\": \"" + CampaignSessionManager.Info.CampaignId + "\", \"type\": \"get\"}", SendCallback); ModdingUtils.SendOOBMessage("{\"sessionid\": \"" + CampaignSessionManager.Info.CampaignId + "\", \"type\": \"get\"}", SendCallback); }
void Update() { var board = BoardSessionManager.Board; var flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static; //Debug.Log("LOS Enabled: " + DistanceLOS.Value); if (board != null && DistanceLOS.Value) { Dictionary <NGuid, CreatureData> creatures = (Dictionary <NGuid, CreatureData>)board.GetType().GetField("_creatures", flags).GetValue(board); foreach (KeyValuePair <NGuid, CreatureData> focusCreature in creatures) { if (focusCreature.Value.Alias == lineLater.Value) { //Debug.Log("Found Focus"); foreach (KeyValuePair <NGuid, CreatureData> entry in creatures) { CreatureBoardAsset creatureBoardAsset; if (PhotonSimpleSingletonBehaviour <CreatureManager> .Instance.TryGetAsset(entry.Value.CreatureId, out creatureBoardAsset)) { float distance = Vector3.Distance(entry.Value.Position, focusCreature.Value.Position); //Debug.Log("Distance: " + distance + " Alias: " + entry.Value.Alias + "Pos: " + entry.Value.Position + " FCPos: " + focusCreature.Value.Position); if (distance < LOSDistance.Value) { creatureBoardAsset.InLineOfSight = true; } else { creatureBoardAsset.InLineOfSight = false; } } } } } } ModdingUtils.OnUpdate(); var diffInSeconds = (DateTime.Now - lastCheck).TotalSeconds; if (diffInSeconds > 3) { lastCheck = DateTime.Now; CheckOOB(); } var diffInHandoutSeconds = (DateTime.Now - lastHandout).TotalSeconds; if (handout && handout.activeSelf && diffInHandoutSeconds > 10) { handout.SetActive(false); } if (board != null) { //Debug.Log("onboard"); Dictionary <NGuid, CreatureData> creatures = (Dictionary <NGuid, CreatureData>)board.GetType().GetField("_creatures", flags).GetValue(board); if (creatures.Count + 1 != lineOfSiteFocusAlias.AcceptableValues.Length && creatures.Count > 0) { List <string> charAliases = new List <string>(); charAliases.Add("Not Set"); foreach (KeyValuePair <NGuid, CreatureData> focusCreature in creatures) { charAliases.Add(focusCreature.Value.Alias); } string tmpVal = lineLater.Value; Config.Remove(lineLater.Definition); lineOfSiteFocusAlias = new AcceptableValueList <String>(charAliases.ToArray()); lineLater = Config.Bind("Line of Sight", "Focused Character", "Not Set", new ConfigDescription("Select the alias to focus on. If not set all characters are in line of sight.", lineOfSiteFocusAlias)); lineLater.Value = tmpVal; } } if (BringPlayersToMe.Value.IsUp()) { PartyManager.SummonAllOnlinePlayersToThisBoard(true, CameraController.Position); } if (ShowHandout.Value.IsUp()) { SystemMessage.AskForTextInput("Handout URL", "Enter the Handout URL (PNG or JPG Image Only)", "OK", delegate(string name) { ModdingUtils.SendOOBMessage("{\"sessionid\": \"" + CampaignSessionManager.Info.CampaignId + "\", \"type\": \"put\", \"handoutUrl\": \"" + name + "\"}", null); }, delegate { }, "Cancel", delegate { }); } }