private void Awake() { instance = this; loadingPanel = GameObject.Find("載入畫面").GetComponent <CanvasGroup>(); loading = GameObject.Find("進度條").GetComponent <Image>(); }
private static void HandleMSG(PrivateMessageEventArgs e) { var sender = e.PrivateMessage.User.Nick; var message = e.PrivateMessage.Message; var channel = e.PrivateMessage.Source; if (message.Equals($"{Config.IRC_CMDChar}uno")) { Game.StartGame(sender, channel); } if (message.Equals($"{Config.IRC_CMDChar}ujoin") || message.Equals($"{Config.IRC_CMDChar}uj")) { Game.AddPlayer(sender, channel); } if (sender == "lonely") // TODO remove this. { if (message.Equals($"{Config.IRC_CMDChar}testdeal")) { GetCard.InitDeck(); Program.client.SendMessage(GetCard.DrawCards(7), channel); } } }
private IEnumerator SpawnCD(GetCard cards) { CardData card = cards.cards[index - 1]; //卡片資料 cost = card.cost; ProduceCD = card.ProduceCD; GetComponent <Button>().interactable = false; temp.Find("遮色片").Find("圖片").GetComponent <Image>().color = Color.gray; // 尋找圖片子物件.顏色 = 顏色.灰色; StartCoroutine(SpawnCDImage(GetCard.instance)); yield return(new WaitForSeconds(ProduceCD)); }
public object Any(GetCard request) { var dds = new DdsConnect(); var game = GameReplayer.Replay(request.PBN); var result = dds.SolveBoard(game); var card = result.FutureCards.Cards[0]; return new GetCardResponse { Rank = card.Rank.ShortName, Suit = card.Suit.ShortName, Score = result.Scores[0] }; }
public object Any(GetCard request) { var dds = new DdsConnect(); var game = GameReplayer.Replay(request.PBN); var result = dds.SolveBoard(game); var card = result.FutureCards.Cards[0]; return(new GetCardResponse { Rank = card.Rank.ShortName, Suit = card.Suit.ShortName, Score = result.Scores[0] }); }
public void RoleSpawm(int index, GetCard cards) { CardData card = cards.cards[index - 1]; //卡片資料(Element從0開始,編號從1開始,故-1) if (index == 1) { Vector3 pos = new Vector2(-7.4f, -3); //座標 Quaternion qua = Quaternion.Euler(0, 0, 0); //角度 GameObject temp = Instantiate(data.Spawn[index - 1].Alliance, pos, qua); //生成 temp.gameObject.GetComponent <Alliance>().hp = card.hp; //添加元件<盟友>.血量 = 卡片.血量 temp.gameObject.GetComponent <RoleMove>().speed = card.speed; //添加元件<盟友移動> 速度 = 卡牌.速度 temp.gameObject.GetComponent <RoleMove>().damage = card.attack; //添加元件<盟友移動>.傷害 = 卡牌.攻擊 temp.gameObject.GetComponent <RoleMove>().AttackCD = card.AttackCD; //添加元件<盟友移動>.攻擊速度 = 卡片.攻擊速度 temp.gameObject.GetComponent <RoleMove>().AttackDistance = card.AtackDistance; //添加元件<盟友移動>.攻擊距離 = 卡片.攻擊距離 } else if (index == 5) { Vector3 pos = new Vector2(-8f, -1.66f); //座標 Quaternion qua = Quaternion.Euler(0, 0, 0); //角度 GameObject temp = Instantiate(data.Spawn[index - 1].Alliance, pos, qua); //生成 temp.gameObject.GetComponent <Alliance>().hp = card.hp; //添加元件<盟友>.血量 = 卡片.血量 temp.gameObject.GetComponent <RoleMove>().speed = card.speed; //添加元件<盟友移動> 速度 = 卡牌.速度 temp.gameObject.GetComponent <RoleMove>().damage = card.attack; //添加元件<盟友移動>.傷害 = 卡牌.攻擊 temp.gameObject.GetComponent <RoleMove>().AttackCD = card.AttackCD; //添加元件<盟友移動>.攻擊速度 = 卡片.攻擊速度 temp.gameObject.GetComponent <RoleMove>().AttackDistance = card.AtackDistance; //添加元件<盟友移動>.攻擊距離 = 卡片.攻擊距離 } else if (index == 8) { Vector3 pos = new Vector2(-8f, -2.8f); //座標 Quaternion qua = Quaternion.Euler(0, 0, 0); //角度 GameObject temp = Instantiate(data.Spawn[index - 1].Alliance, pos, qua); //生成 temp.gameObject.GetComponent <Alliance>().hp = card.hp; //添加元件<盟友>.血量 = 卡片.血量 temp.gameObject.GetComponent <RoleMove>().speed = card.speed; //添加元件<盟友移動> 速度 = 卡牌.速度 temp.gameObject.GetComponent <RoleMove>().damage = card.attack; //添加元件<盟友移動>.傷害 = 卡牌.攻擊 temp.gameObject.GetComponent <RoleMove>().AttackCD = card.AttackCD; //添加元件<盟友移動>.攻擊速度 = 卡片.攻擊速度 temp.gameObject.GetComponent <RoleMove>().AttackDistance = card.AtackDistance; //添加元件<盟友移動>.攻擊距離 = 卡片.攻擊距離 } else { Vector3 pos = new Vector2(-7.4f, -2.3f); //座標 Quaternion qua = Quaternion.Euler(0, 0, 0); //角度 GameObject temp = Instantiate(data.Spawn[index - 1].Alliance, pos, qua); //生成 temp.gameObject.GetComponent <Alliance>().hp = card.hp; //添加元件<盟友>.血量 = 卡片.血量 temp.gameObject.GetComponent <RoleMove>().speed = card.speed; //添加元件<盟友移動> 速度 = 卡牌.速度 temp.gameObject.GetComponent <RoleMove>().damage = card.attack; //添加元件<盟友移動>.傷害 = 卡牌.攻擊 temp.gameObject.GetComponent <RoleMove>().AttackCD = card.AttackCD; //添加元件<盟友移動>.攻擊速度 = 卡片.攻擊速度 temp.gameObject.GetComponent <RoleMove>().AttackDistance = card.AtackDistance; //添加元件<盟友移動>.攻擊距離 = 卡片.攻擊距離 } }
public void RoleCost(GetCard cards, Transform trambattle, BattleManager BattleRoleTransform, BattleManager BattleRolebutton, BattleManager RoleCost, BattleCard canProduce) { for (int i = 0; i < 4; i++) { if (money < BattleManager.instance.RoleCost[i]) { BattleManager.instance.BattleRoleTransform[i].Find("遮色片").Find("圖片").GetComponent <Image>().color = Color.gray; // 尋找圖片子物件.顏色 = 顏色.灰色; BattleManager.instance.BattleRolebutton[i].GetComponent <Button>().interactable = false; } if (BattleManager.instance.BattleRolebutton[i].GetComponent <BattleCard>().canProduce == true) { if (money >= BattleManager.instance.RoleCost[i]) { BattleManager.instance.BattleRoleTransform[i].Find("遮色片").Find("圖片").GetComponent <Image>().color = Color.white; // 尋找圖片子物件.顏色 = 顏色.白色; BattleManager.instance.BattleRolebutton[i].GetComponent <Button>().interactable = true; } } } }
private IEnumerator SpawnCDImage(GetCard cards) { imageCD = 0; while (imageCD < ProduceCD) //迴圈 while(布林值) "當布林值為 true 時執行敘述" { canProduce = false; temp.transform.Find("載入進度條").gameObject.SetActive(true); //顯示載入畫面 imageCD = imageCD + 0.1f; temp.Find("載入進度條").Find("載入進度條進度").GetComponent <Image>().fillAmount = imageCD / ProduceCD; // 尋找圖片子物件.顏色 = 顏色.灰色; if (imageCD >= ProduceCD) { temp.Find("載入進度條").Find("載入進度條進度").GetComponent <Image>().fillAmount = 0; // 尋找圖片子物件.顏色 = 顏色.灰色; temp.transform.Find("載入進度條").gameObject.SetActive(false); //關閉載入畫面 canProduce = true; } yield return(new WaitForSeconds(0.1f)); } }
private void _loginView_GetCard(object sender, EventArgs e) { GetCard?.Invoke(this, null); }
public void Card_Update_Success() { // Create var title = "Test Card " + DateTime.Now.ToShortDateString(); var dict = testConfig.GetDefaultActivityArguments(); dict["PipeID"] = pipe.Id; dict["Title"] = title; dict["DueDate"] = DateTime.Now.AddDays(6); PipefyQueryActivity act = new CreateCard(); var result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); var cardId = (long)result["CardID"]; // Get dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; act = new GetCard(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); var cardJson = (JObject)result["Card"]; Assert.AreEqual(title, cardJson.Value <string>("title")); // Update title = "Updated Card " + DateTime.Now.ToShortDateString(); dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; dict["Title"] = title; act = new UpdateCard(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); // Get dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; act = new GetCard(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); cardJson = (JObject)result["Card"]; Assert.AreEqual(title, cardJson.Value <string>("title")); // Delete dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; act = new DeleteCard(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); }
public void Card_UpdateField_Success() { // Create var title = "Test Card Field " + DateTime.Now.ToShortDateString(); var dict = testConfig.GetDefaultActivityArguments(); var cardDict = customFieldsPhase.GenerateRandomCardDictionary(); dict["PipeID"] = pipe.Id; dict["PhaseID"] = customFieldsPhase.Id; dict["Title"] = title; dict["DueDate"] = DateTime.Now.AddDays(6); dict["DictionaryFields"] = cardDict; PipefyQueryActivity act = new CreateCard(); var result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); var cardId = (long)result["CardID"]; // Get dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; act = new GetCard(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); var cardResult = (Dictionary <string, object>)result["CardFieldsDictionary"]; Assert.AreEqual(cardDict["mileage"].ToString(), cardResult["mileage"].ToString()); Assert.AreEqual(cardDict["chassi_code"].ToString(), cardResult["chassi_code"].ToString()); Assert.AreEqual(cardDict["production_date"].ToString(), cardResult["production_date"].ToString()); CompareDateTime((DateTime)cardDict["bought_on"], cardResult["bought_on"].ToString()); CompareDateTime((DateTime)cardDict["good_until"], cardResult["good_until"].ToString()); // Update cardDict["mileage"] = (long)cardDict["mileage"] + 10; dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; dict["FieldID"] = "mileage"; dict["Value"] = cardDict["mileage"]; act = new UpdateCardField(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); // Get dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; act = new GetCard(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); cardResult = (Dictionary <string, object>)result["CardFieldsDictionary"]; Assert.AreEqual(cardDict["mileage"].ToString(), cardResult["mileage"].ToString()); // Delete dict = testConfig.GetDefaultActivityArguments(); dict["CardID"] = cardId; act = new DeleteCard(); result = WorkflowInvoker.Invoke(act, dict); Assert.IsTrue((bool)result["Success"]); }
public CardPicture(int id) : base() { this.id = id; GetCard = Game.FreeCards[id]; Name = GetCard.ToString() + "_picture"; Size = new Size(69, 105); image = GetCard.GetImage; Image = Image.FromFile("default.jpg"); GetCard.picture = this; Click += new EventHandler((o, a) => { if (Game.players[Game.ActivePlayer].cards.Count == 0 && Game.FreeCards.Count == 0) { Game.Win(Game.players[Game.ActivePlayer]); return; } if (GetCard.player == Game.players[Game.ActivePlayer]) // my turn { if (Card.playing.Count == 0) { Card.playing.Add(GetCard); Game.players[Game.ActivePlayer].occupied.Remove(GetCard.occ); Game.players[Game.ActivePlayer].cards.Remove(GetCard); Location = new Point(Location.X, Location.Y + (int)Pow(-1, Game.ActivePlayer) * 120); if (Game.players[Game.ActivePlayer].cards.Count == 0 && Game.FreeCards.Count == 0) { Game.Win(Game.players[Game.ActivePlayer]); } Game.NextPlayer(); } else { if (Game.players[Game.ActivePlayer].attacking) // could throw more cards { int c = Game.ActivePlayer + 1; if (c >= Game.players.Length) { c = 0; } if (Game.players[c].cards.Count > 0) { for (int i = 0; i < Card.playing.Count; i++) { var item = Card.playing[i]; if (item.face == GetCard.face && item != GetCard) { Card.playing.Add(GetCard); Game.players[Game.ActivePlayer].occupied.Remove(GetCard.occ); Game.players[Game.ActivePlayer].cards.Remove(GetCard); Location = new Point(Location.X, Location.Y + (int)Pow(-1, Game.ActivePlayer) * 90); if (Game.players[Game.ActivePlayer].cards.Count == 0 && Game.FreeCards.Count == 0) { Game.Win(Game.players[Game.ActivePlayer]); } Game.NextPlayer(); } } } } else // defender { for (int i = 0; i < Card.playing.Count; i++) { var item = Card.playing[i]; if (GetCard > item) { Card.playing.Add(GetCard); Game.players[Game.ActivePlayer].occupied.Remove(GetCard.occ); Game.players[Game.ActivePlayer].cards.Remove(GetCard); Card.Beat(GetCard, item); Location = new Point(item.picture.Location.X, item.picture.Location.Y + (int)Pow(-1, Game.ActivePlayer) * 20); if (Game.players[Game.ActivePlayer].cards.Count == 0 && Game.FreeCards.Count == 0) { Game.Draw(); } Game.NextPlayer(true); } } } } } }); }
private void buttonGetCard_Click(object sender, EventArgs e) { GetCard?.Invoke(this, e); }