示例#1
0
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        debugGUIText = GameObject.Find("DebugGameText").GetComponent <Text>();
        stateGUIText = GameObject.Find("StateText").GetComponent <TextCopy>();
        levelGUIText = GameObject.Find("LevelText").GetComponent <Text>();

        stateAction.Add(MatchState.Lobby, this.StateLobby);
        stateAction.Add(MatchState.StartMatch, this.StartMatchState);
        stateAction.Add(MatchState.StartMinigame, this.StartMinigameState);
        stateAction.Add(MatchState.Minigame, this.MinigameState);
        stateAction.Add(MatchState.EndMinigame, this.EndMinigameState);
        stateAction.Add(MatchState.EndMatch, this.EndMatchState);
    }
 private void ClipboardManager_ClipboardChanged(object sender, EventArgs e)
 {
     if (System.Windows.Clipboard.ContainsText())
     {
         var text = System.Windows.Clipboard.GetText();
         var copy = new TextCopy
         {
             Created = DateTime.Now,
             Id      = Guid.NewGuid(),
             Text    = text
         };
         _viewModel.Copies.Add(copy);
     }
 }