public void addEventCard(EventKind e)
    {
        eventCardNum++;

        GameObject g = Instantiate(eventCardPrefab, new Vector3(0, 0, 0), Quaternion.identity);

        g.GetComponent <eventCardUI> ().setEventCardPanel(eventCardPanel);
        Text t = g.transform.GetChild(0).gameObject.GetComponent <Text>();

        t.text = e.ToString();
        g.GetComponent <Image>().color = Color.green;

        /*
         * if (eventCardNum != 1)
         * {
         *
         * foreach (Transform child in transform.GetChild(3))
         * {
         * child.position = child.position - new Vector3(maxSpace / 2, 0, 0);
         * }
         * }
         */
        g.transform.parent = this.gameObject.transform;
        //g.transform.position = eventCardStart.transform.position;

        g.transform.position = eventCardStart.transform.position + new Vector3(0, 100, 0);
        g.GetComponent <playerCardUI> ().setDestination(eventCardStart.transform.position + new Vector3(maxSpace * (eventCardNum - 1), 0, 0));
        //eventCardStart.transform.position += new Vector3(maxSpace / 2, 0, 0);



        g.transform.parent = transform.GetChild(3);
    }
Пример #2
0
 public void UpdateType(EventKind value, UserSession session = null)
 {
     if (value != Kind)
     {
         UpdatedAt = InvokeUpdate(Id, new { kind = value.ToString().ToLower() }, session).UpdatedAt;
         Kind      = value;
     }
 }
Пример #3
0
        public override string ToString()
        {
            Exception ex = Error;

            if (ex is AggregateException)
            {
                ex = ((AggregateException)ex).InnerExceptions[0];
            }

            if (ex != null)
            {
                return($"{Event} - {ex.Message}");
            }
            else
            {
                return(Event.ToString());
            }
        }
    // delete event card to gui of
    public void deleteEventCard(EventKind e)
    {
        int i;

        for (i = 0; i < cityCardNum + eventCardNum; i++)
        {
            if (e.ToString().Equals(content.GetChild(i).GetChild(0).GetComponent <Text>().text))
            {
                break;
            }
        }
        for (int j = i; j < cityCardNum + eventCardNum; j++)
        {
            content.GetChild(j).GetChild(0).GetComponent <Text>().text = content.GetChild(j + 1).GetChild(0).GetComponent <Text>().text;
        }
        content.GetChild(cityCardNum + eventCardNum - 1).GetChild(0).GetComponent <Text>().text = "";
        eventCardNum--;
        setBar();
        content.GetChild(cityCardNum + eventCardNum).gameObject.SetActive(false);
    }
Пример #5
0
 /// <summary>
 /// Create a new event.
 /// </summary>
 public static Event Create(
     string title,
     string description   = null,
     EventKind kind       = EventKind.Other,
     DateTime?starts_at   = null,
     DateTime?finishes_at = null,
     UserSession session  = null
     )
 {
     // Updating events with negative IDs is reserved for creation of new ones
     return(InvokeUpdate(-1,
                         new
     {
         title,
         description,
         kind = kind.ToString().ToLower(),
         starts_at,
         finishes_at
     },
                         session
                         ));
 }
Пример #6
0
 /// <summary>
 /// Modify an existing event by ID.
 /// </summary>
 public static Event Modify(
     int event_id,
     string title,
     string description   = null,
     EventKind kind       = EventKind.Other,
     DateTime?starts_at   = null,
     DateTime?finishes_at = null,
     UserSession session  = null
     )
 {
     return(InvokeUpdate(
                event_id,
                new
     {
         title,
         description,
         kind = kind.ToString().ToLower(),
         starts_at,
         finishes_at
     },
                session
                ));
 }
    public void deleteEventCard(EventKind e)
    {
        bool find = false;

        foreach (Transform child in transform.GetChild(3))
        {
            if (!find && child.GetChild(0).GetComponent <Text>().text.Equals(e.ToString()))
            {
                find = true;
                Destroy(child.gameObject);
            }

            /*else if (!find)
             * {
             *  child.position = child.position + new Vector3(maxSpace / 2, 0, 0);
             * }*/
            else if (find)
            {
                child.position = child.position - new Vector3(maxSpace, 0, 0);
            }
        }
        //eventCardStart.transform.position -= new Vector3(maxSpace / 2, 0, 0);
        eventCardNum--;
    }
Пример #8
0
 public override string ToString() => EventKind.ToString();
Пример #9
0
 public void eventCard(Player p, EventKind ek)
 {
     displayRecord(p.getRoleKind().ToString() + " played Event Card: " + ek.ToString());
 }
    // add event card to gui of other player
    public void addEventCard(EventKind e)
    {
        content.GetChild(cityCardNum + eventCardNum).gameObject.SetActive(true);
        content.GetChild(cityCardNum + eventCardNum).GetChild(0).GetComponent <Text>().text = e.ToString();

        content.GetChild(cityCardNum + eventCardNum).GetComponent <Image>().color            = Color.green;
        content.GetChild(cityCardNum + eventCardNum).GetChild(0).GetComponent <Text>().color = Color.black;

        eventCardNum++;
        setBar();
    }
Пример #11
0
 public override string getName()
 {
     return(eventKind.ToString());
 }