Ejemplo n.º 1
0
    void MakeRoundEventList()
    {
        SetRandomRoundEventID();
        SetListSize(eventScrollPanelrect);
        List <GameObject> eventList = new List <GameObject>();

        for (int i = 0; i < numOfShowingRoundEvent; i++)
        {
            int        randomID   = Random.Range(0, RandomRoundEventID.Count);
            RoundEvent roundEvent = database.roundEventDatabase[RandomRoundEventID[randomID]];
            RandomRoundEventID.RemoveAt(randomID);

            GameObject newEvent = Instantiate(roundEventListTemplate, new Vector3(0f, (eventScrollPanelrect.rect.height / 2) - 120f * i - 20f, 0f), Quaternion.identity) as GameObject;
            newEvent.name = roundEvent.eventName;

            /* 다른 children이 추가되면 아래 코드에서 에러가 발생할 수도? */
            newEvent.GetComponentInChildren <Image>().sprite = Sprite.Create(roundEvent.eventImage, new Rect(0, 0, imageIconSize, imageIconSize), new Vector2(0f, 0f));
            newEvent.transform.SetParent(eventScrollPanel.transform, false);

            newEvent.GetComponentInChildren <Text>().text = CreateEventTooltip(roundEvent);
            newEvent.GetComponentInChildren <RoundEventBuyButton>().SetEvent(roundEvent);

            eventList.Add(newEvent);
        }
    }
Ejemplo n.º 2
0
    //itemDatabase와는 달리 다른 script(e.g. inventory)가 없어 이곳에 함수를 넣음. 나중에 다른 적절한 script가 생기면 옮기자.
    public void AddRoundEvent(RoundEvent roundEvent)
    {
        if (GameManager.gm.isRoundEventOn)
        {
            GameManager.gm.ShowMessageBox("이미 적용된 행사가 있습니다.");
            return;
        }

        else
        {
            if (GameManager.gm.Money() < roundEvent.eventPrice)
            {
                GameManager.gm.ShowMessageBox("돈이 부족합니다.");
                return;
            }

//            else if (Developer.dev.developerCount[Developer.dev.FindPostIDByName("Publicity")] < roundEvent.eventRequiredDev) {
//               GameManager.gm.ShowMessageBox("개발자 수가 부족합니다.");
//            }

            else
            {
                GameManager.gm.ChangeMoneyInterRound(-roundEvent.eventPrice);
                GameManager.gm.isRoundEventOn = true;

                GameManager.gm.ShowMessageBox("행사가 적용되었습니다.");
                GameManager.gm.roundEventName = roundEvent.eventName;
                StartCoroutine(roundEvent.eventStart());
            }
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Raise the specified event e.
        /// </summary>
        /// <param name="e">E.</param>
        public void Raise(RoundEvent e)
        {
            _eventDelegate del;

            if (delegates.TryGetValue(e.GetType(), out del))
            {
                del.Invoke(e);
            }
        }
Ejemplo n.º 4
0
    public string CreateEventTooltip(RoundEvent roundEvent)
    {
        string tooltip = "<color=#ffffff>" + roundEvent.eventName + "</color>\n\n";

        tooltip += "<color=#000000>" + roundEvent.eventDescription + "</color>\n\n";
        tooltip += "<color=#990282>" + "가격 : " + roundEvent.eventPrice + "</color>\t\t";
        tooltip += "<color=#990282>" + "필요 개발자 수 : " + roundEvent.eventRequiredDev + "</color>";
        return(tooltip);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Initializes the capture and round events and listeners.
    /// </summary>
    private void Start()
    {
        // Create capture attempt listeners
        CaptureAttempted = new CaptureEvent();

        // Start listening to capture attempts
        CaptureAttempted.AddListener(OnCaptureAttempted);

        // Create round event listeners
        RoundEnded = new RoundEvent();

        // Start listening to round ends
        RoundEnded.AddListener(OnRoundEnded);
    }
Ejemplo n.º 6
0
    public void Awake()
    {
        if (gameManager != null)
        {
            Destroy(gameObject);
            return;
        }
        else
        {
            gameManager = this;
        }

        playerFinishedRoundEvent   = new RoundEvent();
        destructableDestroyedEvent = new DestructableEvent();
        pointsGainedEvent          = new IntEvent();
        panicGainedEvent           = new FloatEvent();
        comboStartedEvent          = new UnityEvent();
        comboEndedEvent            = new UnityEvent();
        roundStartedEvent          = new UnityEvent();
        cashGainedEvent            = new IntEvent();
    }
Ejemplo n.º 7
0
 public void SetEvent(RoundEvent roundEvent)
 {
     buyingEvent = roundEvent;
 }