コード例 #1
0
    public void InitGameEventManager()
    {
        eventReader = new GameEventReader();
        //gameEvents = new List<GameEvent>();
        gameEventDisplayers = new List <GameEventDisplayer>();

        EventRoot = new GameObject("Event Root");
        EventRoot.transform.SetParent(this.transform);
        EventRoot.transform.localPosition = Vector3.zero;

        currentMemories = new List <int>();
        //eventReader.TestGameEvent();
    }
コード例 #2
0
    public void UpdateGameEventPanel(GameEvent gameEvent)
    {
        Clear();
        mainPanel.gameObject.SetActive(true);
        this.gameEvent = gameEvent;
        switch (gameEvent.eventType)
        {
        case GameEventType.NormalNonoptionGainbuffEvent:
            try
            {
                NormalNonoptionGainbuffEvent convertedEvent = (NormalNonoptionGainbuffEvent)gameEvent;
                EnableNonoptionPart();
                currentBuff  = convertedEvent.GetBuff();
                effectString = convertedEvent.GetEffectDescription();
                effect.text  = effectString;
            } catch (InvalidCastException ex)
            {
                Debug.Log(ex.StackTrace);
            }
            break;

        case GameEventType.NormalNonoptionGainitemsEvent:
            try
            {
                NormalNonoptionGainitemsEvent convertedEvent = (NormalNonoptionGainitemsEvent)gameEvent;
                EnableNonoptionPart();
                currentItems = convertedEvent.GetItems();
                effectString = convertedEvent.GetEffectDescription();
                effect.text  = effectString;
            } catch (InvalidCastException ex)
            {
                Debug.Log(ex.StackTrace);
            }
            break;

        case GameEventType.NormalNonoptionMemoryEvent:
            try
            {
                NormalNonoptionMemoryEvent convertedEvent = (NormalNonoptionMemoryEvent)gameEvent;
                EnableNonoptionPart();
                currentMemory = convertedEvent.GetMemoryId();
                effectString  = convertedEvent.GetEffectDescription();
                effect.text   = effectString;
            } catch (InvalidCastException ex)
            {
                Debug.Log(ex.StackTrace);
            }
            break;

        case GameEventType.NormalOptionEvent:
            try
            {
                NormalOptionEvent convertedEvent = (NormalOptionEvent)gameEvent;
                EnableOptionPart();
                currentOptions = convertedEvent.GetOptions();
                for (int i = 0; i < optionsButton.Count; i++)
                {
                    if (i < currentOptions.Count)
                    {
                        optionsButton[i].gameObject.SetActive(true);
                        optionsButton[i].GetComponent <Text>().text = currentOptions[i].name;
                    }
                    else
                    {
                        optionsButton[i].gameObject.SetActive(false);
                    }
                }
            } catch (InvalidCastException ex)
            {
                Debug.Log(ex.StackTrace);
            }

            break;

        case GameEventType.MysterypersonGainitemsEvent:
            try
            {
                MysterypersonGainitemsEvent convertedEvent = (MysterypersonGainitemsEvent)gameEvent;
                EnableOptionPart();
                currentOptions = convertedEvent.GetOptions();
                for (int i = 0; i < optionsButton.Count; i++)
                {
                    if (i < currentOptions.Count)
                    {
                        optionsButton[i].gameObject.SetActive(true);
                        optionsButton[i].GetComponent <Text>().text = currentOptions[i].name;
                    }
                    else
                    {
                        optionsButton[i].gameObject.SetActive(false);
                    }
                }
            } catch (InvalidCastException ex)
            {
                Debug.Log(ex.StackTrace);
            }
            break;

        case GameEventType.MysterypersonGaincharacterEvent:
            try
            {
                MysterypersonGaincharacterEvent convertedEvent = (MysterypersonGaincharacterEvent)gameEvent;
                EnableOptionPart();
                currentMonsterType  = convertedEvent.GetMonsterType();
                currentMonsterLevel = convertedEvent.GetLevel();
                currentOptions      = convertedEvent.GetOptions();
                for (int i = 0; i < optionsButton.Count; i++)
                {
                    if (i < currentOptions.Count)
                    {
                        optionsButton[i].gameObject.SetActive(true);
                        optionsButton[i].GetComponent <Text>().text = currentOptions[i].name;
                    }
                    else
                    {
                        optionsButton[i].gameObject.SetActive(false);
                    }
                }
            } catch (InvalidCastException ex)
            {
                Debug.Log(ex.StackTrace);
            }
            break;

        default:
            break;
        }
        name.text        = gameEvent.eventName;
        description.text = gameEvent.eventDescription;
        eventReader      = new GameEventReader();
        Sprite sprite;

        if ((sprite = Resources.Load(imagePath + eventReader.GetGameEventIndex(gameEvent), typeof(Sprite)) as Sprite) != null)
        {
            cg.sprite = sprite;
        }
    }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     GameEventReader eventReader = new GameEventReader();
 }