public void deletePlayerCardFromOtherPlayer(RoleKind k, Card c)
 {
     if (c is EventCard)
     {
         foreach (Transform t in this.transform)
         {
             if (t.gameObject.active && t.GetChild(2).GetComponent <Text>().text.Equals(k.ToString()))
             {
                 t.GetComponent <otherPlayerController>().deleteEventCard(((EventCard)c).getEventKind());
                 break;
             }
         }
     }
     else
     {
         foreach (Transform t in this.transform)
         {
             if (t.gameObject.active && t.GetChild(2).GetComponent <Text>().text.Equals(k.ToString()))
             {
                 t.GetComponent <otherPlayerController>().deleteCityCard(((CityCard)c).getCity().getCityName());
                 break;
             }
         }
     }
 }
    public void displayText(RoleKind role, string text)
    {
        string previousText = textDisplay.GetComponent <Text>().text;

        textDisplay.GetComponent <Text>().text     = previousText + role.ToString() + ": " + text + " \n";
        scrollBar.GetComponent <Scrollbar>().value = 0;
    }
 public void setRole(RoleKind k)
 {
     this.transform.GetChild(2).GetComponent <Text>().text = k.ToString();
     if (map.getRoleColor(k) != null)
     {
         this.transform.GetChild(1).GetComponent <Image>().color = map.getRoleColor(k);
     }
 }
Beispiel #4
0
 private bool compareRole(RoleKind role)
 {
     if (curRole == null)
     {
         return(false);
     }
     return(curRole.getRoleKind() == role);
 }
 public bool contains(RoleKind roleKind)
 {
     foreach (Pawn pawn in pawns)
     {
         if (pawn.getRoleKind() == roleKind)
         {
             return(true);
         }
     }
     return(false);
 }
    /*
     * public string findPlayerWithSpecificCity(string cName){
     *      foreach (Transform t in this.transform) {
     *              if (t.gameObject.active == true) {
     *                      foreach (Transform tr in t.GetChild(3).GetChild(1)) {
     *                              if (tr.GetChild (0).GetComponent<Text> ().text.Equals (cName)) {
     *                                      return
     *                              }
     *                      }
     *
     *              }
     *      }
     * }
     */
    public void swapRoleSelf(RoleKind roleKindNew)
    {
        this.transform.GetChild(4).GetChild(0).GetComponent <Image> ().color = Maps.getInstance().getRoleColor(roleKindNew);
        this.transform.GetChild(4).GetChild(1).GetComponent <Text> ().text   = roleKindNew.ToString();

        Transform t = playerSelect.selfButton.transform.GetChild(0);

        t.GetChild(0).GetComponent <Image> ().color = Maps.getInstance().getRoleColor(roleKindNew);
        t.GetChild(1).GetComponent <Text> ().text   = roleKindNew.ToString();
        t.name = roleKindNew.ToString();
    }
 public Role(RoleKind r)
 {
     rolekind  = r;
     handlimit = 7;
     if (r == RoleKind.Archivist)
     {
         handlimit = 8;
     }
     description = Maps.getInstance().getDescription(r);
     pawn        = new Pawn(r);
 }
    public void addMainPlayer(RoleKind k)
    {
        this.transform.GetChild(4).gameObject.SetActive(true);
        this.transform.GetChild(4).GetChild(0).GetComponent <Image> ().color = Maps.getInstance().getRoleColor(k);
        this.transform.GetChild(4).GetChild(1).GetComponent <Text> ().text   = k.ToString();

        Transform t = playerSelect.selfButton.transform.GetChild(0);

        t.GetChild(0).GetComponent <Image> ().color = Maps.getInstance().getRoleColor(k);
        t.GetChild(1).GetComponent <Text> ().text   = k.ToString();
        t.name = k.ToString();
    }
Beispiel #9
0
 public void setRole(RoleKind r)
 {
     rolekind = r;
     if (r == RoleKind.BioTerrorist)
     {
         this.gameObject.GetComponent <Image>().color = Maps.getInstance().getRoleColor(r);
     }
     else
     {
         this.gameObject.GetComponent <SpriteRenderer>().color = Maps.getInstance().getRoleColor(r);
     }
 }
 public void swapRoleOther(RoleKind roleKindOld, RoleKind roleKindNew)
 {
     foreach (Transform t in this.transform)
     {
         if (t.gameObject.activeSelf)
         {
             if (t.transform.GetChild(2).GetComponent <Text> ().text.Equals(roleKindOld.ToString()))
             {
                 t.transform.GetChild(2).GetComponent <Text> ().text   = roleKindNew.ToString();
                 t.transform.GetChild(1).GetComponent <Image> ().color = Maps.getInstance().getRoleColor(roleKindNew);
                 break;
             }
         }
     }
 }
    public void addOtherPlayer(RoleKind k)
    {
        foreach (Transform t in this.transform)
        {
            if (!t.gameObject.active)
            {
                t.gameObject.SetActive(true);
                t.GetComponent <otherPlayerController>().setRole(k);
                break;
            }
        }

        playerSelect.addOtherPlayer(k);

        // apply it on current object's material
    }
    public void swapRole(RoleKind oldRole, RoleKind newRole)
    {
        foreach (Transform t in this.transform)
        {
            if (t.GetChild(0).GetComponent <Text> ().text.Equals(oldRole.ToString()))
            {
                t.GetChild(0).GetComponent <Text> ().text = newRole.ToString();
                t.name = newRole.ToString();
                if (map.getRoleColor(newRole) != null)
                {
                    t.GetComponent <Image> ().color = map.getRoleColor(newRole);
                }

                break;
            }
        }
    }
            public async Task SetRole(CommandContext context,
                                      [Description("Values: Member, Officer, Leader")] RoleKind roleKind,
                                      [Description("Name of the corresponding discord role")] DiscordRole discordRole)
            {
                if (roleKind == RoleKind.Everyone)
                {
                    return;
                }

                var existingRole = Guild.Roles
                                   .FirstOrDefault(x => x.Kind == roleKind);

                if (existingRole == null)
                {
                    existingRole = new Role()
                    {
                        DiscordId = discordRole.Id,
                        GuildId   = Guild.Id,
                        Kind      = roleKind
                    };

                    m_dbContext.Roles.Add(existingRole);
                }
                else
                {
                    existingRole.DiscordId = discordRole.Id;
                    m_dbContext.Roles.Update(existingRole);
                }

                await m_dbContext.SaveChangesAsync();

                if (!discordRole.IsMentionable)
                {
                    try
                    {
                        await discordRole.ModifyAsync(mentionable : true);
                    }
                    catch (UnauthorizedException)
                    {
                        ResponseString = "Commands completed, but you need to manually re-order the roles in your serve so that 'Incite Bot' is above any roles you are trying to set here.";
                    }
                }
            }
    //This is for initializsation, for the beginning of the game
    public void addOtherPlayer(RoleKind k)
    {
        int i = 0;

        foreach (Transform t in this.transform)
        {
            if (!t.gameObject.activeSelf)
            {
                t.gameObject.SetActive(true);
                t.GetChild(0).GetComponent <Text>().text = k.ToString();
                t.name = k.ToString();
                if (map.getRoleColor(k) != null)
                {
                    t.GetComponent <Image>().color = map.getRoleColor(k);
                }

                break;
            }
            i++;
        }

        // apply it on current object's material
    }
    public void addPlayerCardToOtherPlayer(RoleKind k, Card c)
    {
        if (c.getType() == CardType.EventCard)
        {
            foreach (Transform t in this.transform)
            {
                if (t.gameObject.active && t.childCount >= 3 && t.GetChild(2).GetComponent <Text>().text.Equals(k.ToString()))
                {
                    t.GetComponent <otherPlayerController>().addEventCard(((EventCard)c).getEventKind());
                    break;
                }
            }
        }
        else
        {
            //for test use
            bool find = false;

            foreach (Transform t in this.transform)
            {
                if (t.gameObject.activeSelf && t.childCount >= 3 && t.GetChild(2).GetComponent <Text>().text.Equals(k.ToString()))
                {
                    Debug.Log("Card type " + c.getType());
                    t.GetComponent <otherPlayerController>().addCityCard(((CityCard)c).getCity().getCityName());
                    //Debug.Log("find"+k.ToString()+" "+ ((CityCard)c).getCity().getCityName().ToString());
                    find = true;
                    break;
                }
            }

            /*
             * if (!find)
             * {
             *  Debug.Log("notfind" + k.ToString() + " " + ((CityCard)c).getCity().getCityName().ToString());
             * }*/
        }
    }
Beispiel #16
0
 public static Task <Models.Role> GetRoleAsync(this DbSet <Models.Role> roles, UInt64 discordGuildId, RoleKind roleKind)
 {
     return(roles
            .FirstAsync(x => x.Guild.DiscordId == discordGuildId && x.Kind == roleKind));
 }
    public GameData(Game game)
    {
        challenge             = game.getChallenge();
        currentGamePhase      = game.getCurrentPhase();
        currentPlayerRoleKind = game.getCurrentPlayer().getRoleKind();
        infectionRateIndex    = game.getInfectionIndex();
        outBreakRate          = game.getOutbreakRate();
        remainingResearch     = game.getRemainingResearch();
        seed = game.seed;
        BioTerroristVolunteer = game.BioTerroristVolunteer;
        currentPlayerIndex    = game.currentPlayerIndex;

        difficulity = game.nEpidemicCard;

        playerCardDeck       = game.getPlayerCardDeckString();
        playerDiscardPile    = game.getPlayerDiscardPileString();
        infectionCardDeck    = game.getInfectionDeckString();
        infectionDiscardPile = game.getInfectionDiscardPileString();
        allHandCards         = game.getAllHandCards();
        EpidemicCardIntList  = EpidemicCard.getEpidemicCard().getIntList();
        foreach (City city in game.getCities())
        {
            CityInfo cityInfo = new CityInfo(city);
            CityInfoList.Add(cityInfo);
        }

        foreach (KeyValuePair <Color, Disease> entry in game.getDiseases())
        {
            diseaseInfoList.Add(new DiseaseInfo(entry.Value));
        }

        foreach (Player player in game.getPlayers())
        {
            PlayerCardList playerHand = new PlayerCardList();
            mobileHospitalActivated.Add(player.getMobileHospitalActivated());
            if (player.getRoleKind() == RoleKind.ContingencyPlanner && player.getEventCardOnTopOfRoleCard() != null)
            {
                eventCardOnTopOfRoleCard = player.getEventCardOnTopOfRoleCard().getName();
            }
            if (player.getRoleKind() == RoleKind.FieldOperative)
            {
                FOcubes = player.getAllCubes();
            }
            hasCommercialTravelBanInfrontOfPlayer.Add(player.hasEventCardInFront());
            //CommercialTravelBanTurn.Add (player.getCommercialTravelBanTurn());
            roleKindList.Add(player.getRoleKind());
            foreach (PlayerCard pc in player.getHand())
            {
                if (pc.getType().Equals(CardType.CityCard))
                {
                    CityCard cityCard = (CityCard)pc;
                    playerHand.playerHand.Add(cityCard.getName());
                    //Debug.Log ("City Card: " + cityCard.getName());
                }
                else if (pc.getType().Equals(CardType.EventCard))
                {
                    EventCard eventCard = (EventCard)pc;
                    playerHand.playerHand.Add(eventCard.getName());
                    //Debug.Log ("Event Card: " + eventCard.getEventKind());
                }
                else
                {
                    InfectionCard infectionCard = (InfectionCard)pc;
                    playerHand.playerHand.Add((infectionCard.getName()));
                    //Debug.Log ("Event Card: " + infectionCard.getName());
                }
            }
            playerCardList.Add(playerHand);
        }
    }
 public RequireInciteRoleAttribute(RoleKind kind)
 {
     RoleKind = kind;
 }
Beispiel #19
0
 public static Task <Models.Role> GetRoleAsync(this DbSet <Models.Role> roles, CommandContext context, RoleKind roleKind)
 {
     return(roles.GetRoleAsync(context.Guild.Id, roleKind));
 }
 public Color getRoleColor(RoleKind roleKind)
 {
     return(roleColors[roleKind]);
 }
Beispiel #21
0
    /*
     * void Awake()
     * {
     *          /*
     *  City[] cities = GetComponentsInParent<City>();
     *  foreach (City city in cities)
     *  {
     *      if (city.getCityName() == CityName.Atlanta)
     *      {
     *                          Debug.Log (city.cityName);
     *          currentCity = city;
     *                          Debug.Log ("find");
     *      }
     *  }
     *  Debug.Log(currentCity.getCityName().ToString());
     *
     *          Transform g = this.transform.parent;
     *          //Debug.Log (g.name);
     *          foreach (Transform child in g) {
     *                  City city = child.gameObject.GetComponent<City> ();
     *                  if (city!=null && city.getCityName() == CityName.Atlanta)
     *                  {
     *
     *                          currentCity = city;
     *
     *                  }
     *          }
     *          //Debug.Log(currentCity.getCityName().ToString());
     * }
     */

    public Pawn(RoleKind aRolekind)
    {
        rolekind = aRolekind;
    }
 public string getDescription(RoleKind roleKind)
 {
     return(playerDescriptions[roleKind]);
 }