private void BuildPackageList(CardLibrary cardLibrary) { SortedList sl = new SortedList(); string[] ss = null; int count = cardLibrary.GetNonDIYCount(); for (int i = 0; i < count; i++) { ss = cardLibrary.GetCardByIndex(i).package.Split(',', ','); foreach (string s in ss) { if (!sl.Contains(s)) { sl.Add(s, s); } } } ss = new string[sl.Count]; for (int i = 0; i < sl.Count; i++) { ss[i] = (string)sl.GetByIndex(i); } File.WriteAllLines(appPath + "\\PackageList.txt", ss); }
private void button10_Click(object sender, EventArgs e) { string YFCCDir = ""; //MessageBox.Show("请选择YGORPO数据文件所在位置"); OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = YFCCDir + "\\YGODATA\\"; openFileDialog1.Filter = "YGOPRO数据文件 (cards.cdb)|cards.cdb|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 0; openFileDialog1.RestoreDirectory = true; openFileDialog1.Title = "请选择YGORPO数据文件所在位置"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { this.Text = "数据读入中,请稍候"; DisableAllButton(); Application.DoEvents(); YGOProCardsReader mReader = new YGOProCardsReader(); CardDescription[] cards = mReader.Read(openFileDialog1.FileName, ProcessChanged); this.Text = "索引建立中,请稍候"; CardsSaver lSaver = new LuceneSaver(); lSaver.Save("CardIndex", cards, ProcessChanged); this.Text = "卡包列表生成中,请稍候"; CardLibrary cardLibrary = CardLibrary.GetInstance(); BuildPackageList(cardLibrary); this.Text = "辅助转换工具"; EnableAllButton(); MessageBox.Show("索引建立完成!"); } }
private void button6_Click(object sender, EventArgs e) { this.Text = "测试中,请稍候"; CardsReader mReader = new LuceneReader(); CardLibrary cardLibrary = new CardLibrary(mReader.Read("CardIndex")); OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "中中版查卡器数据文件 (ocg.yxwp)|ocg.yxwp|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 0; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { File.WriteAllText("test.txt", "", Encoding.GetEncoding("GB2312")); int i = 0; StreamReader sr = new StreamReader(openFileDialog1.FileName, Encoding.GetEncoding("GB2312")); while (!sr.EndOfStream) { string s = sr.ReadLine(); string[] ss = s.Split('^'); string n = ss[1]; i++; if (cardLibrary.GetCardByName(n) == null && cardLibrary.GetCardByOldName(n) == null) { File.AppendAllText("test.txt", string.Format("{0} {1}\r\n", i, n), Encoding.GetEncoding("GB2312")); } } sr.Close(); } this.Text = "辅助转换工具"; MessageBox.Show("测试完成!"); }
private void button7_Click(object sender, EventArgs e) { this.Text = "转换中,请稍候"; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "DIY卡数据文件 (diycards.dll)|diycards.dll|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 0; openFileDialog1.RestoreDirectory = true; string dirpath = DB2Config.GetInstance().GetSetting("DeckPath") + "..\\"; if (!Directory.Exists(dirpath)) { dirpath = appPath + "\\Image\\"; } if (!Directory.Exists(dirpath)) { dirpath = appPath; } openFileDialog1.InitialDirectory = dirpath; if (openFileDialog1.ShowDialog() == DialogResult.OK) { setInProcess(true); CardsReader mReader = new DIYReader(); CardLibrary cardLibrary = new CardLibrary(mReader.Read(openFileDialog1.FileName, pbProcess, spStat)); CardsSaver lSaver = new LuceneSaver(); lSaver.Save("DIYCardIndex", cardLibrary.GetCards(), pbProcess, spStat); this.Text = "辅助转换工具"; MessageBox.Show("索引建立完成!"); setInProcess(false); pbProcess.Value = 0; spStat.Text = "准备就绪"; } this.Text = "辅助转换工具"; }
public void AddCardUI(int id) { //Debug.Log("AddCardUI() Log: Function entered " + id); Vector2 spawnPos = new Vector2(0, 0); Button listCard = Instantiate(listPrefab, spawnPos, Quaternion.identity) as Button; listCard.transform.SetParent(GetListTransform().transform, false); var txt = listCard.GetComponentInChildren <Text>(); var ident = listCard.GetComponent <CardIdentity>(); ident.id = id; txt.text = ident.GetName(); var list = CardLibrary.Get().cardList; for (int i = 0; i < list.Count; i++) { if (list[i].cardID == ident.id) { Debug.Log(ident.id); LibraryCard.Cult libCult = CardLibrary.Get().cardList[i].cult; string cult = LibraryCard.CultToString(libCult); listCard.GetComponent <Image>().color = CultColorUI(cult); break; } } uiCards.Add(listCard); MoveCardsUI(); deckCounterTxt.text = "Size: " + deck.Count; }
private static void AddCardsToDeck(ref List <BaseCard> deck, ClassificationTypes classification, int amount) { var potentialCards = CardLibrary.Where(c => c.Classification == classification).ToList(); int cardsAdded = 0; while (cardsAdded < amount) { int selected = Random.Range(0, potentialCards.Count); var card = potentialCards[selected]; var deckCopy = deck.ToList(); bool canBeAdded = (card.DeckGenerationRequirements.Count == 0 || card.DeckGenerationRequirements.All(req => req.MeetsRequirement(deckCopy))) && card.MeetsRarityRequirements() && deck.Count(c => c.CardName.Equals(card.CardName)) < 4; if (canBeAdded) { deck.Add(card); cardsAdded++; } } }
public void ShowStats(PlayCardController pcc, PlayCard playCard) { var libCard = CardLibrary.Get().GetCard(playCard.libId); if (libCard.health > 0) { var transHealth = pcc.transform.FindChild("Health"); var healthText = transHealth.GetComponent <TextMesh> (); healthText.text = "" + playCard.health; transHealth.gameObject.SetActive(!pcc.turned); } if (libCard.attack > 0) { var transAttack = pcc.transform.FindChild("Attack"); var attackText = transAttack.GetComponent <TextMesh> (); attackText.text = "" + playCard.attack; transAttack.gameObject.SetActive(!pcc.turned); } if (libCard.moveRange > 1) { var transActions = pcc.transform.FindChild("Action"); var actionsText = transActions.GetComponent <TextMesh> (); actionsText.text = "" + playCard.actions; transActions.gameObject.SetActive(!pcc.turned); } if (libCard.atkRange > 1) { var transRange = pcc.transform.FindChild("Action"); var rangeText = transRange.GetComponent <TextMesh> (); rangeText.text = "" + libCard.atkRange; transRange.gameObject.SetActive(!pcc.turned); } }
public static void CreateBaseDeck(Player player) { List <Card> deck = new List <Card>() { CardLibrary.CreateLeader(), CardLibrary.CreateWarrior(), CardLibrary.CreateBerserker(), CardLibrary.CreateHealer(), CardLibrary.CreateKnight(), CardLibrary.CreateSpearman(), CardLibrary.CreatePreacher(), CardLibrary.CreateLeeroyJenkins(), CardLibrary.CreateSoulReaper(), CardLibrary.CreateGuardsman(), CardLibrary.CreateRider(), CardLibrary.CreateSkeleton(), CardLibrary.CreateGhoul(), CardLibrary.CreateFireball(), CardLibrary.CreateShovel(), CardLibrary.CreateGrace(), }; foreach (Card card in deck) { card.Owner = player; } player.Deck = deck; }
void Awake() { playerInstance = GameObject.Find("Player").GetComponent <Player>(); gameControlInstance = gc.GetComponent <GameControl> (); gameControlGUIInstance = gc.GetComponent <GameControlGUI> (); shopControlInstance = gc.GetComponent <ShopControl> (); shopControlGUIInstance = gc.GetComponent <ShopControlGUI> (); clickControlInstance = gc.GetComponent <ClickControl> (); gridControlInstance = gc.GetComponent <GridControl>(); optionControlInstance = gc.GetComponent <OptionControl>(); dragControlInstance = gc.GetComponent <DragControl>(); eventGUIInstance = gc.GetComponent <EventGUI>(); enemyLibraryInstance = gc.GetComponent <EnemyLibrary>(); cardLibraryInstance = gc.GetComponent <CardLibrary>(); goalLibraryInstance = gc.GetComponent <GoalLibrary>(); guiStyleLibraryInstance = gc.GetComponent <GUIStyleLibrary>(); mainMenuInstance = gc.GetComponent <MainMenu>(); encyclopediaMenuInstance = gc.GetComponent <EncyclopediaMenu>(); godChoiceMenuInstance = gc.GetComponent <GodChoiceMenu>(); customizeMenuInstance = gc.GetComponent <CustomizeMenu>(); gridCursorControlInstance = gc.GetComponent <GridCursorControl>(); menuControlInstance = gc.GetComponent <MenuControl>(); tutorialInstance = gc.GetComponent <Tutorial>(); deckAnimateInstance = deck.GetComponent <DeckAnimate>(); shopAndGoalParentCanvasInstance = goalandshopparent .GetComponent <ShopAndGoalParentCanvas>(); shopGridCanvasInstance = shopgrid .GetComponent <ShopGridCanvas>(); gridCursorControlGUIInstance = gridcursorcontrolgui .GetComponent <GridCursorControlGUI>(); }
private void Awake() { Instance = this; SaveData = Resources.Load <CardLibrarySaveData>("SaveData"); //SaveData.SingleCardLibrarieDatas. }
private void listViewEx1_MouseDown(object sender, MouseEventArgs e) { VirtualListView listViewEx = CurrentListView(); if (e.Clicks == 2 && e.Button == MouseButtons.Left) { ListViewItem item = listViewEx.GetItemAt(e.X, e.Y); if (item == null) { return; } int id = int.Parse(item.SubItems[8].Text); CardDescription card = CardLibrary.GetInstance().GetCardByID(id); if (CardDescription.isExtraCard(card)) { Global.frmDeckEditHolder.AddToFusionDeck(card.ID); } else { Global.frmDeckEditHolder.AddToMainDeck(card.ID); } } }
private static BaseCard GetRandomAdventure() { var adventures = CardLibrary.Where(c => c.Classification == ClassificationTypes.Adventure).ToList(); var card = adventures.Skip(Random.Range(0, adventures.Count)).First(); return(card); }
private void listViewEx1_ItemDrag(object sender, ItemDragEventArgs e) { if (!string.Equals(DB2Config.GetInstance().GetSetting("NoDrag"), "True", StringComparison.OrdinalIgnoreCase) && e.Button == MouseButtons.Left) { Application.DoEvents(); VirtualListView ListViewEx = (VirtualListView)sender; ListViewItem item = (ListViewItem)e.Item;//listViewEx1.GetItemAt(e.X, e.Y); if (item == null) { return; } if (item.Selected == false) { item.Selected = true; listViewEx1.Update(); } DragCard dragcard = new DragCard(); int id = int.Parse(item.SubItems[8].Text); dragcard.Card = CardLibrary.GetInstance().GetCardByID(id); dragcard.FromObject = ListViewEx; ListViewEx.DoDragDrop(dragcard, DragDropEffects.Copy); } }
/// <summary> /// /// Loading card library- to be called on initialisation of game /// /// </summary> public void LoadLibrary() { //Load in cardList upon initialization of the game CardLibrary = new CardLibrary(); CardLibrary.InitLibrary(); LoadDirectionaries(); }
public bool NextFx() { if (fxIdx >= CardLibrary.Get().GetCard(libId).fxList.Count - 1) { return(false); } fxIdx++; return(true); }
public void Setup(CardLibrary library, CardManager manager) { cardLibrary = library; cardManager = manager; cardLibrary.onBeginDragCard += OnBeginDragLibraryCard; cardLibrary.onDragCard += OnDragLibraryCard; cardLibrary.onEndDragCard += OnEndDragLibraryCard; cardLibrary.onForceReleaseDragCard += OnForceReleaseLibraryCard; }
public static CardLibrary Get() { if (instance == null) { instance = new CardLibrary(); instance.Init(); } return instance; }
public static Sprite GetBoardCardImage(int Id) { if (!Info.UiInfo.CardImage.ContainsKey(Id)) { var CardStandardInfo = CardLibrary.GetCardStandardInfo(Id); Texture2D texture = CardStandardInfo.Icon; Info.UiInfo.CardImage.Add(Id, Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero)); } return(Info.UiInfo.CardImage[Id]); }
private void button5_Click(object sender, EventArgs e) { this.Text = "转换中,请稍候"; CardsReader mReader = new LuceneReader(); CardLibrary cardLibrary = new CardLibrary(mReader.Read("CardIndex")); CardsSaver aSaver = new AllCardsSaver(); aSaver.Save("allcards.dll", cardLibrary.GetCards()); this.Text = "辅助转换工具"; MessageBox.Show("导出完成!"); }
private void button3_Click(object sender, EventArgs e) { string YFCCDir = null; mAppInterface.GetAppDirEx(mAppInterface.AppName_YFCC, ref YFCCDir); string YFCCData = YFCCDir + "\\YGODATA\\YGODAT.DAT"; if (!File.Exists(YFCCData)) { YFCCData = YFCCDir + "\\YGODATA\\YGOSYS.DB"; } else { YFCCData = ""; } //MessageBox.Show("请选择天堂狐查卡器数据文件所在位置"); OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = YFCCDir + "\\YGODATA\\"; openFileDialog1.Filter = "天堂狐查卡器数据文件 (YGODAT.DAT;YGOSYS.DB)|YGODAT.DAT;YGOSYS.DB|YGODAT.MDB)|YGODAT.MDB|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 0; openFileDialog1.RestoreDirectory = true; openFileDialog1.Title = "请选择天堂狐查卡器数据文件所在位置"; openFileDialog1.FileName = "YGODAT.DAT"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { this.Text = "数据读入中,请稍候"; DisableAllButton(); Application.DoEvents(); CardsReader mReader = new YFCCReader(); CardLibrary cardLibrary = new CardLibrary(mReader.Read(openFileDialog1.FileName, ProcessChanged)); //选择禁卡表 LimitedListManager llm = LimitedListManager.GetInstance(); llm.LoadFromYFCC(openFileDialog1.FileName); frmLimitedList form = new frmLimitedList(); form.ShowDialog(); this.Text = "索引建立中,请稍候"; CardsSaver lSaver = new LuceneSaver(); lSaver.Save("CardIndex", cardLibrary.GetCards(), ProcessChanged); this.Text = "卡包列表生成中,请稍候"; BuildPackageList(cardLibrary); this.Text = "辅助转换工具"; EnableAllButton(); MessageBox.Show("索引建立完成!\r\r请接着导入YGOPRO补充数据,否则将不能使用效果分类搜索,并且载入YGOPRO卡组时可能出错!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private static void AddLessonsToDeck(ref List <BaseCard> deck, LessonTypes lessonType, int amount) { var card = CardLibrary .Where(c => c.Classification == ClassificationTypes.Lesson) .First(l => ((ILessonProvider)l).LessonType == lessonType); for (int i = 0; i < amount; i++) { deck.Add(card); } }
private static int GetImageIndexByIndex(int index, bool largeicon) { CardDescription card = CardLibrary.GetInstance().GetCardByIndex(index); if (largeicon) { return(Global.largePicLoader.GetLargeIcoIndex(card.ID)); } else { return(card.iCardType); } }
private void button1_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex < 0) { MessageBox.Show("请选择一个默认的禁卡表!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } LimitedListManager llm = LimitedListManager.GetInstance(); llm.SelectedIndex = listBox1.SelectedIndex; CardLibrary.GetInstance().UpdateLimitedList(llm.SelcetedItem); this.Close(); }
public static List <LibraryCard> DeckFromJSON(JSONObject jsDeck) { List <LibraryCard> deck = new List <LibraryCard>(); for (int i = 0; i < jsDeck.Count; i++) { int id = (int)jsDeck[i]; LibraryCard card = CardLibrary.Get().GetCard(id); deck.Add(card); } return(deck); }
protected override void OnValueChanged(string key, string value) { if (key == "AllowDIY") { if (string.Equals(value, "True", StringComparison.OrdinalIgnoreCase)) { CardLibrary.GetInstance().AllowDIY = true; } else { CardLibrary.GetInstance().AllowDIY = false; } } }
static void ImportCards(CommandTerminal.CommandArg[] args) { CardLibrary inst = GameObject.FindObjectOfType <CardLibrary>(); if (inst == null) { GameBuilderConsoleCommands.Log($"Please open the card library (via Logic Tool) before using this command."); return; } string path = GameBuilderConsoleCommands.JoinTailToPath(args); if (path != null) { inst.ImportLocalByPath(new string[] { path }); } }
//根据卡片ID返回大图文件名 public static string GetImagePath(int id) { //先随便找张卡测试一下图片是以密码名来存的,还是以狐查的序号名来存的 bool isCheatCodeMode = false; string testfilename = "92377303.jpg"; if (File.Exists(PicLoader.commonImagePath + testfilename) || File.Exists(PicLoader.imagePath + testfilename)) { isCheatCodeMode = true; } if (isCheatCodeMode) { //如果是密码名保存的,不用尝试OCGSOFT的公用卡图目录,但要考虑多版本卡图的情况 CardDescription card = CardLibrary.GetInstance().GetCardByID(id); string[] ss = card.cheatcode.Split(','); foreach (string s in ss) { string filename = s.TrimStart(new char[] { '0' }) + ".jpg"; string path = PicLoader.imagePath + filename; if (File.Exists(path)) { return(path); } } return(null); } else { //如果是以序号名来存的,优先使用OCGSOFT的公用卡图目录 string filename = id.ToString() + ".jpg"; string path = PicLoader.commonImagePath + filename; if (File.Exists(path)) { return(path); } path = PicLoader.imagePath + filename; if (File.Exists(path)) { return(path); } return(null); } }
internal List <CardData> ToCardData(CardLibrary library) { List <CardData> datas = new List <CardData>(); foreach (var card in library.Cards) { if (datas.Exists(x => x.Name == card.name)) { datas.Find(x => x.Name == card.name).CardQuantity++; } else { datas.Add(new CardData(card)); } } return(datas); }
public void SpawnCard() { Vector3 spawnPos; float x = 7f; float y = 3.5f; int counter = -1; int nameCounter = -1; int cardCounter = 0; GameObject card; for (int j = 0; j < 27; j++) { for (int i = 0; i < 3; i++) { nameCounter++; counter++; card = (GameObject)Resources.Load("Prefabs/CardDB"); spawnPos = new Vector3(x + (i * 2.2f), y - (j * 3.05f), 0); GameObject cardSpawn = (GameObject)Instantiate(card, spawnPos, Quaternion.identity); cardSpawn.name = "card" + nameCounter.ToString(); //Fix card position somehow... cardSpawn.transform.rotation = Quaternion.EulerAngles(-Mathf.PI / 2, 0, 0); //cardSpawn.transform.localScale = new Vector3(1, 1, 1); cardSpawn.transform.gameObject.AddComponent <CardControllerDB>(); cards.Add(cardSpawn); var rend = cardSpawn.transform.FindChild("GFX").GetComponent <MeshRenderer>(); for (int k = 0; k < cards.Count; k++) { rend.material.mainTexture = CardLibrary.Get().cardList[k].texture_p; } if (counter >= (cardLibrary.cardList.Count - 1)) { counter = -1; } cardCounter++; if (cardCounter == cardsCount) { return; } } } }
private void button2_Click(object sender, EventArgs e) { MessageBox.Show("请选择迷你卡片数据目录CardLib所在位置"); FolderBrowserDialog openFolderDialog1 = new FolderBrowserDialog(); openFolderDialog1.RootFolder = Environment.SpecialFolder.MyComputer; openFolderDialog1.SelectedPath = appPath; if (openFolderDialog1.ShowDialog() == DialogResult.OK) { this.Text = "转换中,请稍微"; CardsReader mReader = new MiniCardXReader(); CardLibrary cardLibrary = new CardLibrary(mReader.Read(openFolderDialog1.SelectedPath)); CardsSaver lSaver = new LuceneSaver(); lSaver.Save("CardIndex", cardLibrary.GetCards()); this.Text = "辅助转换工具"; MessageBox.Show("索引建立完成!"); } }
private static void CreatBoardCardActual() { Info.UiInfo.CardBoard.transform.GetChild(1).GetComponent <Text>().text = Info.UiInfo.CardBoardTitle; Info.UiInfo.ShowCardLIstOnBoard.ForEach(Destroy); List <Card> Cards = Info.GlobalBattleInfo.TargetCardList; for (int i = 0; i < Cards.Count; i++) { var CardStandardInfo = CardLibrary.GetCardStandardInfo(Cards[i].CardId); GameObject NewCard = Instantiate(Info.UiInfo.CardModel); NewCard.GetComponent <BoardCardInfo>().Rank = i; NewCard.transform.SetParent(Info.UiInfo.Constant); Texture2D texture = CardStandardInfo.Icon; NewCard.GetComponent <Image>().sprite = Command.UiCommand.GetBoardCardImage(Cards[i].CardId); Info.UiInfo.ShowCardLIstOnBoard.Add(NewCard); } Info.UiInfo.Constant.GetComponent <RectTransform>().sizeDelta = new Vector2(Cards.Count * 325 + 200, 800); }
void Awake() { playerInstance = GameObject.Find("Player").GetComponent<Player>(); gameControlInstance = gc.GetComponent<GameControl> (); gameControlGUIInstance = gc.GetComponent<GameControlGUI> (); shopControlInstance = gc.GetComponent<ShopControl> (); shopControlGUIInstance = gc.GetComponent<ShopControlGUI> (); clickControlInstance = gc.GetComponent<ClickControl> (); gridControlInstance = gc.GetComponent<GridControl>(); optionControlInstance = gc.GetComponent<OptionControl>(); dragControlInstance = gc.GetComponent<DragControl>(); eventGUIInstance = gc.GetComponent<EventGUI>(); enemyLibraryInstance = gc.GetComponent<EnemyLibrary>(); cardLibraryInstance = gc.GetComponent<CardLibrary>(); goalLibraryInstance = gc.GetComponent<GoalLibrary>(); guiStyleLibraryInstance = gc.GetComponent<GUIStyleLibrary>(); mainMenuInstance = gc.GetComponent<MainMenu>(); encyclopediaMenuInstance = gc.GetComponent<EncyclopediaMenu>(); godChoiceMenuInstance = gc.GetComponent<GodChoiceMenu>(); customizeMenuInstance = gc.GetComponent<CustomizeMenu>(); gridCursorControlInstance = gc.GetComponent<GridCursorControl>(); menuControlInstance = gc.GetComponent<MenuControl>(); tutorialInstance = gc.GetComponent<Tutorial>(); deckAnimateInstance = deck.GetComponent<DeckAnimate>(); shopAndGoalParentCanvasInstance = goalandshopparent .GetComponent<ShopAndGoalParentCanvas>(); shopGridCanvasInstance = shopgrid .GetComponent<ShopGridCanvas>(); gridCursorControlGUIInstance = gridcursorcontrolgui .GetComponent<GridCursorControlGUI>(); }