private void SetGameType(DataGridViewCellFormattingEventArgs e) { if (dataGridView1["GameTypeID", e.RowIndex].Value != null && dataGridView1["GameTypeID", e.RowIndex].Value.ToString() != "" && dataGridView1["GameTypeID", e.RowIndex].Value.ToString() != "0") { e.Value = Ap.GetGameTypeImage(dataGridView1[1, e.RowIndex].Value.ToString()); } }
public override Color At(PointType point) { var colorA = Ap.At(Ap.Transform.Inverse() * point); var colorB = Bp.At(Bp.Transform.Inverse() * point); return((colorA + colorB) * 0.5); }
public Int32 Cast(Int32 Barrier) { Int32 Dmg = MDmg.Int() * Ap.Int(); Dmg -= (Int32)(Barrier * 0.2); return(Dmg < 0 ? 0 : Dmg); }
public Prefs() { Ap = new Ap(); Is = new Is(); Lan = new Lan(); Rta = new Rta(); }
public static bool ShowMainOnline(DataSet ds, bool isLoadLastGame) { App.Model.Db.Game dbGame = App.Model.Db.Game.CreateGame(Ap.Cxt, ds); if (dbGame == null) { return(false); } Ap.NewGame(); MainOnline mainOnlineForm = new InfinityChess.WinForms.MainOnline(); frmProgress = ProgressForm.Show(mainOnlineForm, "Loading..."); mainOnlineForm.Game = Ap.Game; mainOnlineForm.Game.DbGame = dbGame; if (isLoadLastGame) { SetUserEngine(mainOnlineForm.Game); } mainOnlineForm.Show(); mainOnlineForm.LoadGame(); frmProgress.Close(); ActivateMainForm(mainOnlineForm); return(true); }
public override void CompTick() { base.CompTick(); if (this.parent.Faction == Faction.OfPlayer) { if (this.AbilityData.AllPowers.Count == 0) { Pawn p = parent as Pawn; foreach (Apparel Ap in p.apparel.WornApparel) { CompAbilityItem comp = Ap.TryGetComp <AbilityUser.CompAbilityItem>(); if (comp != null) { foreach (AbilityDef Pa in comp.Props.Abilities) { this.AddApparelAbility(Pa); } } } foreach (var Eq in p.equipment.AllEquipmentListForReading) { CompAbilityItem comp = Eq.TryGetComp <AbilityUser.CompAbilityItem>(); if (comp != null) { foreach (AbilityDef Pa in comp.Props.Abilities) { this.AddWeaponAbility(Pa); } } } } } }
public static bool LoadGameByChallengeID(int challengeID) { DataSet ds = SocketClient.AddGameData(challengeID, PlayingModeData.Instance.ChessTypeID); if (ds == null || ds.Tables.Count == 0) { return(false); } Ap.NewGame(); MainOnline mainOnlineForm = new InfinityChess.WinForms.MainOnline(); frmProgress = ProgressForm.Show(mainOnlineForm, "Loading..."); mainOnlineForm.Game = Ap.Game; mainOnlineForm.Show(); mainOnlineForm.Game.DbGame = App.Model.Db.Game.CreateGame(Ap.Cxt, ds); if (mainOnlineForm.Game.DbGame != null) { mainOnlineForm.NewGame(); } frmProgress.Close(); ActivateMainForm(mainOnlineForm); return(true); }
private void SetGameTypeTitle() { string gameTypeTitle = Ap.GetGameTypeTitle(Ap.EngineOptions.GameType); lblSelectedGameType.Text = gameTypeTitle; txtMatchTitle.Text = Environment.MachineName + ", " + gameTypeTitle; }
protected virtual void SaveDocking() { if (dp != null) { string fileName = Ap.FileDock(this.Game.GameMode); dp.SaveAsXml(fileName); } }
private void SetRank(DataGridViewCellFormattingEventArgs e) { if (dgvRegisterPlayer["RoleID", e.RowIndex].Value != null && dgvRegisterPlayer["RoleID", e.RowIndex].Value.ToString() != "" && dgvRegisterPlayer["RoleID", e.RowIndex].Value.ToString() == "1") { e.Value = Ap.GetUserRankImage("Admin"); //For Admin Image } else if (dgvRegisterPlayer["Rank", e.RowIndex].Value != null && dgvRegisterPlayer["Rank", e.RowIndex].Value.ToString() != "" && dgvRegisterPlayer["Rank", e.RowIndex].Value.ToString() != "0") { e.Value = Ap.GetUserRankImage(dgvRegisterPlayer["Rank", e.RowIndex].Value.ToString()); //For User Rank Image } }
private void SetRankImage(DataGridViewCellFormattingEventArgs e, string rankColumn, string roleIdColumn) { if (dgvMatches[roleIdColumn, e.RowIndex].Value != null && dgvMatches[roleIdColumn, e.RowIndex].Value.ToString() != "" && dgvMatches[roleIdColumn, e.RowIndex].Value.ToString() == "1") { e.Value = Ap.GetUserRankImage("Admin"); //For Admin Image } else if (dgvMatches[rankColumn, e.RowIndex].Value != null && dgvMatches[rankColumn, e.RowIndex].Value.ToString() != "" && dgvMatches[rankColumn, e.RowIndex].Value.ToString() != "0") { e.Value = Ap.GetUserRankImage(dgvMatches[rankColumn, e.RowIndex].Value.ToString()); //For User Rank Image } }
protected override void LoadDefaultPanels() { RemoveAllKibitzers(); System.IO.File.Delete(Ap.FileDock(base.Game.GameMode)); LoadDefaultDocking(); clockWindowToolStripMenuItem.Checked = true; notationToolStripMenuItem.Checked = true; analysisToolStripMenuItem.Checked = true; capturePieceToolStripMenuItem.Checked = true; }
private void LoadMainForm() { SetInvisible(); frmProgress = ProgressForm.Show(this, "Loading...", 2000); frmProgress.FormClosed += new FormClosedEventHandler(frmProgress_FormClosed); Application.DoEvents(); Ap.NewGame(); mainForm = new InfinityChess.WinForms.MainOffline(); mainForm.Show(); }
private void tsmFactorySetting_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageForm.Confirm(this, MsgE.ConfirmResetSetting); if (dialogResult == DialogResult.Yes) { ApWin.ShowUserProfile = true; Ap.ResetFactorySettings(); LoadDefaultPanels(); this.Close(); } }
private void SetRank(DataGridViewCellFormattingEventArgs e) { if (dataGridView1["RoleID", e.RowIndex].Value != null && dataGridView1["RoleID", e.RowIndex].Value.ToString() != "" && dataGridView1["RoleID", e.RowIndex].Value.ToString() == "1") { //Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Ranks\A.PNG"); e.Value = Ap.GetUserRankImage("Admin"); } else if (dataGridView1["Rank", e.RowIndex].Value != null && dataGridView1["Rank", e.RowIndex].Value.ToString() != "" && dataGridView1["Rank", e.RowIndex].Value.ToString() != "0") { //Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Ranks\" + dataGridView1["Rank", e.RowIndex].Value + ".PNG"); e.Value = Ap.GetUserRankImage(dataGridView1["Rank", e.RowIndex].Value.ToString()); } }
public static void ShowMainOnline(int challengeID, ChallengeStatusE status, int gameID) { Ap.NewGame(); MainOnline mainOnlineForm = new InfinityChess.WinForms.MainOnline(); frmProgress = ProgressForm.Show(mainOnlineForm, "Loading..."); mainOnlineForm.Game = Ap.Game; mainOnlineForm.Show(); mainOnlineForm.LoadGame(challengeID, status, gameID); frmProgress.Close(); ActivateMainForm(mainOnlineForm); }
private static void RunApp() { bool createdNew = true; using (Mutex mutex = new Mutex(true, "InfiChess", out createdNew)) { Ap.Init(ApModuleE.Both); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Winforms.Startup()); Ap.UnInit(ApModuleE.Both); } }
private void SetRank(DataGridViewCellFormattingEventArgs e) { if (dgvWantin["RoleID", e.RowIndex].Value != null && dgvWantin["RoleID", e.RowIndex].Value.ToString() != "" && dgvWantin["RoleID", e.RowIndex].Value.ToString() == "1") { e.Value = Ap.GetUserRankImage("Admin"); //For Admin Image } else if (dgvWantin["Rank", e.RowIndex].Value != null && dgvWantin["Rank", e.RowIndex].Value.ToString() != "" && dgvWantin["Rank", e.RowIndex].Value.ToString() != "0") { e.Value = Ap.GetUserRankImage(dgvWantin["Rank", e.RowIndex].Value.ToString()); //For User Rank Image } //if (dgvWantin["Rank", e.RowIndex].Value != null && dgvWantin["Rank", e.RowIndex].Value.ToString() != "" && dgvWantin["Rank", e.RowIndex].Value.ToString() != "0") //{ // Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Ranks\" + dgvWantin["Rank", e.RowIndex].Value + ".PNG"); // e.Value = item; //} }
private void btnBrowse_Click(object sender, EventArgs e) { saveFileDialog1.Filter = "Databases icd(*" + Files.DatabaseExtension + ")|*" + Files.DatabaseExtension; saveFileDialog1.FileName = "*" + Files.DatabaseExtension; saveFileDialog1.InitialDirectory = Ap.FolderDatabase; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fileName = saveFileDialog1.FileName; txtDatabasePath.Text = fileName; Ap.LoadDatabase(fileName); Ap.Database.Save(); Ap.EngineOptions.DatabaseFile = fileName; Ap.EngineOptions.Save(); } }
private void OnlineClient_FormClosing(object sender, FormClosingEventArgs e) { if (Ap.IsGameInProgress || Ap.HasKibitzers) { ChatClient.Write(ChatTypeE.OnlineClient, ChatMessageTypeE.Warning, ChatTypeE.OnlineClient, MsgE.ErrorRoomChange, 0); e.Cancel = true; return; } else if (isNormalClose) { if (MessageForm.Confirm(this, MsgE.ConfirmLogOff) == DialogResult.No) { e.Cancel = true; return; } } Ap.UnInit(ApModuleE.Online); if (isNormalClose) { ProgressForm frm = ProgressForm.Show(this, "Logging off..."); Ap.CurrentUser.Logoff(); frm.Close(); } UnInitDockingEvents(); SaveDocking(); Ap.CanAutoChallenge = true; Ap.PlayingMode.ChessTypeID = 1; PlayingModeData.Instance.ChessType = ChessTypeE.Human; Ap.SelectedRoomID = 0; if (Ap.PlayingMode.SelectedEngine != null) { Ap.PlayingMode.SelectedEngine.Close(); Ap.PlayingMode.SelectedEngine = null; } PlayingModeData.Instance.Save(); UserFormulas.Instance = null; }
public void InitGamesGrid() { if (cmboDatabaseFilePaths.Items != null) { if (cmboDatabaseFilePaths.Items.Count > 0) { ToolStripComboBox toolStripcmbo = toolStripFilePaths.Items["cmboDatabaseFilePaths"] as ToolStripComboBox; ComboBox cmboDBFilePaths = toolStripcmbo.ComboBox as ComboBox; string databaseFileName = cmboDBFilePaths.SelectedValue.ToString(); this.Text = "Database ( " + Path.GetFileName(databaseFileName) + " )"; if (databaseFileName != string.Empty) { if (!databaseFileName.EndsWith(Files.DatabaseExtension)) { ShowInvalidFileFormatMessage(); return; } try { Ap.LoadDatabase(databaseFileName); } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); ShowInvalidFileFormatMessage(); return; } Ap.Options.CurrentDatabaseFilePath = databaseFileName; Ap.Options.Save(); GameGridView.AutoGenerateColumns = false; ProgressForm frm = ProgressForm.Show(this, "Loading Database...."); DataTable gameItems = Ap.Database.GameItems.GetGamesData(); DataBind(gameItems); frm.Close(); GameGridView.Focus(); } } } }
public override Color At(PointType point) { var colorMain = Main.At(point); if (colorMain == Main.A) { return(Ap.At(Ap.Transform.Inverse() * point)); } if (colorMain == Main.B) { return(Bp.At(Bp.Transform.Inverse() * point)); } var altMain = Color.White - colorMain; var colorA = colorMain * Ap.At(Ap.Transform.Inverse() * point); var colorB = altMain * Bp.At(Bp.Transform.Inverse() * point); return(colorA + colorB); }
private void SaveGame(string P1, string P2, int MatchID) { App.Model.GameData _GameData = new App.Model.GameData(this.Game); // Players and Result _GameData.White1 = P1; _GameData.White2 = P1; _GameData.Black1 = P2; _GameData.Black2 = P2; _GameData.Tournament = Title; _GameData.TournamentGuid = TournamentGuid; _GameData.IsECO = false; _GameData.EcoCode = "344"; _GameData.IsEloWhite = false; _GameData.EloWhite = 0; _GameData.IsEloBlack = false; _GameData.EloBlack = 0; _GameData.Result = ""; _GameData.ResultSymbol = ""; _GameData.IsYear = false; _GameData.Year = 0; _GameData.IsMonth = false; _GameData.Month = 0; _GameData.IsDay = false; _GameData.Day = 0; _GameData.TournamentMatchID = MatchID; string gameXml = UData.ToString(_GameData.Kv.DataTable); string fileName = "uba.icd";// InfinityChess.Offline.Forms.GlobalSet.Default.CurrentGameFile; if (gameXml != "") { Ap.LoadDatabase(fileName); Ap.Database.AppendGame(gameXml); Ap.Database.Save(); } }
public override int GetHashCode() { int hash = 1; if (Coin != 0) { hash ^= Coin.GetHashCode(); } if (Crystal != 0) { hash ^= Crystal.GetHashCode(); } if (Hp != 0) { hash ^= Hp.GetHashCode(); } if (Ad != 0) { hash ^= Ad.GetHashCode(); } if (Ap != 0) { hash ^= Ap.GetHashCode(); } if (Addef != 0) { hash ^= Addef.GetHashCode(); } if (Apdef != 0) { hash ^= Apdef.GetHashCode(); } hash ^= strongArr_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private void Init() { Ap.Init(ApModuleE.Online); GuestAuthentication(); room = new RoomUc(); room.LoadPlayerGrid += new RoomUc.PlayerDataGridHandler(room_LoadPlayerGrid); room.LoadGameGrid += new RoomUc.GameDataGridHandler(room_LoadGameGrid); room.LoadChallengeGrid += new RoomUc.ChallengeDataGridHandler(room_LoadChallengeGrid); room.LoadRoomInfoPage += new RoomUc.RommInfoPageHandler(room_LoadRoomInfoPage); room.LoadUserMessages += new RoomUc.UserMessagesHandler(room_LoadUserMessages); SocketClient.Instance.ServerDownError += new SocketClient.OnServerDownErrorEventHandler(Instance_ServerDownError); Ap.MsgQueue.Register(this); InitDockPanel(); CreateDockWindow(); timer1.Start(); timerHeartbeat.Start(); playersUc.SelectPlayer += new PlayersUc.SelectedPlayerHandler(playersUc_SelectPlayer); PlayersUc.RefreshData += new EventHandler(PlayersUc_RefreshData); }
public void ReplaceGameInCurrentGameDatabase() { InfinityChess.GameData.frmGameData frmGameData = new InfinityChess.GameData.frmGameData(this.MainForm); frmGameData.Game = this.Game; if (frmGameData.ShowDialog(this) == DialogResult.OK) { string fileName = string.Empty; if (Ap.Options.CurrentGameGuid == string.Empty) { fileName = Ap.Options.DefaultGameDatabaseFilePath; this.Game.GameData.Guid = string.Empty; this.Game.SaveGame(fileName); Ap.Databases.Add(fileName); Ap.Options.CurrentGameDatabaseFilePath = fileName; Ap.Options.CurrentGameGuid = this.Game.GameData.Guid; Ap.Options.Save(); MainForm.GameSelectedMode(); this.FocusOpenedDatabaseForm(); } else { fileName = Ap.Options.CurrentGameDatabaseFilePath; Ap.LoadDatabase(fileName); GameItem gameItem = Ap.Database.GameItems.GetGameByGuid(Ap.Options.CurrentGameGuid); int currentGameIndex = Ap.Database.GameItems.GetCurrentGameIndex(); this.Game.GameData.Guid = Ap.Options.CurrentGameGuid; string updatedGameXml = this.Game.GetGameXml(); Ap.Database.UpdateGame(updatedGameXml, currentGameIndex); Ap.Database.Save(); MainForm.GameSelectedMode(); this.FocusOpenedDatabaseForm(); } } }
private void btnHelp_Click(object sender, EventArgs e) { Ap.Help(this, HelpTopicIdE.UserData); }
private void btnHelp_Click(object sender, EventArgs e) { Ap.Help(this, HelpTopicIdE.PositionSetup); }
private void btnHelp_Click(object sender, EventArgs e) { Ap.Help(this, HelpTopicIdE.PlayingMode); }
protected override void LoadPanels() { #region Load from xml string fileName = Ap.FileDock(base.Game.GameMode); if (LoadFromFile(fileName)) { return; } string defaultFileName = Ap.FileDockDefault(base.Game.GameMode); LoadFromFile(defaultFileName); #endregion #region Load Manually ChessBoard.Show(dp, DockState.Document); if (Config.IsDev) { DevUc.Show(ChessBoard.Pane, null); } ClockUc.Show(dp, DockState.DockRight); NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85); GameInfoUc.Visible = Ap.Options.ShowGameInfo; CapturePieceUc.Visible = Ap.Options.ShowCapturedPieces; ChessBoard.TabText = "Board"; ChessBoard.HideOnClose = true; if (Config.IsDev) { DevUc.TabText = "DevUc"; DevUc.HideOnClose = true; } DockContent chatParent = NotationUc; switch (base.Game.GameMode) { case GameMode.None: break; case GameMode.Kibitzer: NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85); ScoringUc.Show(NotationUc.Pane, null); BookUc.Show(NotationUc.Pane, null); chatParent = NotationUc; break; case GameMode.OnlineHumanVsHuman: NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85); chatParent = NotationUc; break; case GameMode.OnlineHumanVsEngine: case GameMode.OnlineEngineVsEngine: NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85); AnalysisUc1.Show(NotationUc.Pane, DockAlignment.Bottom, 0.60); chatParent = AnalysisUc1; break; } ChatUc.Show(chatParent.Pane, DockAlignment.Bottom, 0.50); AudienceUc.Show(ChatUc.Pane, null); #endregion }
private void btnHelp_Click(object sender, EventArgs e) { Ap.Help(this, HelpTopicIdE.Tournament); }
void OnGUI() { //guidText = EditorGUI.TextField(new Rect(5, 20, 400, 18), lastSelAltas.name); ap = (Ap)EditorGUI.EnumPopup(new Rect(3, 2, position.width - 20, 25), "PrefabIn:", ap); GUILayout.Space(20); if (isFetching) { if (window != null) { EditorGUI.ProgressBar(new Rect(5,20, window.position.width - 10, 20), fetchedRate , string.Format("Fetching {0}/{1}", index, prefabFiles.Length)); } else { Debug.Log("window == null"); } GUILayout.Space(25); } else { if (GUILayout.Button("Refresh")) { FetchDependencies(apToPath[(int)ap]); } GUILayout.Label(logInfo); } { if (sels == null || sels.Length == 0){ GUI.enabled = false; } if (GUILayout.Button("Selet last")) { foreach (var sel in sels) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(sel), typeof(Object))); } } GUI.enabled = true; } GUILayout.Space(10); int c = Mathf.FloorToInt((position.width - 20) / 150); int w = Mathf.FloorToInt((position.width - 20) / c); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); if (depPrefabNames != null) { for (int i = 0; i < depPrefabNames.Count; i += c) { GUILayout.BeginHorizontal(); for (int j = 0; j < c; j++) { if (i + j < depPrefabNames.Count) if (GUILayout.Button(System.IO.Path.GetFileNameWithoutExtension(depPrefabNames[i + j]), GUILayout.Width(w))) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(depPrefabNames[i + j], typeof(GameObject))); } } GUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); }