示例#1
0
 void OnEnable()
 {
     currentSystem = EventSystem.current;
     currentSystem.SetSelectedGameObject (firstSelected);
     currentSystem.GetComponent<AudioSource>().PlayOneShot (entered);
     currentSystem.GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat ("SFX Volume");
 }
示例#2
0
文件: menu.cs 项目: RazorX2/vrgame
 //    public GameObject leftgo;
 //    public GameObject rightgo;
 void Start()
 {
     paused = false;
     menuscreen = GameObject.FindGameObjectWithTag ("Menu");
     menuscreen.SetActive (false);
     myEventSystem = GameObject.Find("EventSystem").GetComponent<UnityEngine.EventSystems.EventSystem> ();
 }
示例#3
0
	// Use this for initialization
	void Start ()
	{

		events = GameObject.Find ("EventSystem").GetComponent<EventSystem> ();
		Time.timeScale = 1f;

	}
示例#4
0
    void Awake()
    {
        for(int i = 0; i < instatiate.Length; i++)
        {
            Instantiate(instatiate[i]);
        }

        canvas = Instantiate(canvas) as Canvas;
        levelWinScreen = Instantiate(levelWinScreen) as UIAnimateState;
        Transform midPanel = levelWinScreen.transform.FindChild("MidPanel");
        if(midPanel)
        {
            timeText = midPanel.GetComponentInChildren<Text>();

            Transform eggPanel = midPanel.FindChild("GoldenEggPanel");
            if(eggPanel)
            {
                foundEggPanel = eggPanel.FindChild("FoundPanel");
                notFoundEggPanel = eggPanel.FindChild("NotFoundPanel");
            }
        }

        levelRepeatScreen = Instantiate(levelRepeatScreen) as UIAnimateState;
        levelPauseScreen = Instantiate(levelPauseScreen) as UIAnimateState;
        gameWonScreen = Instantiate(gameWonScreen) as UIAnimateState;

        levelWinScreen.transform.SetParent(canvas.transform, false);
        levelRepeatScreen.transform.SetParent(canvas.transform, false);
        levelPauseScreen.transform.SetParent(canvas.transform, false);
        gameWonScreen.transform.SetParent(canvas.transform, false);

        eventSys = GameObject.FindObjectOfType<EventSystem>();

        CheckInput();
    }
示例#5
0
 // Use this for initialization
 void Start()
 {
     if (eventSystem == null) {
         eventSystem = GameObject.Find ("EventSystem").GetComponent<EventSystem> ();
     }
     eventSystem.SetSelectedGameObject (selectButton.gameObject);
 }
示例#6
0
 // Use this for initialization
 void Start()
 {
     selection = GameObject.Find("EventSystem").GetComponent<EventSystem>();
     for (int i = 0; i < screens.Count; i++) {
         if (screens[i].gameObject.name != "Main")
             screens[i].SetActive (false);
     }
 }
	// Use this for initialization
	void Start ()
	{
	    eventSystem = FindObjectOfType<EventSystem>();
	    rewiredEventSystem = FindObjectOfType<RewiredStandaloneInputModule>();
	    controller = Rewired.ReInput.players.GetPlayer(controllerNumber);

	    GetComponentInChildren<Text>().text = (controllerNumber+1).ToString();
	}
示例#8
0
	void Start()
	{
		esyst = FindObjectOfType<EventSystem>();
		ChatMsgs = new List<Message>();
		cs = FindObjectOfType<ChatSystem>();
		MessageObjects = new List<GameObject>();
		ChangeType(PlrMessageType.Default);
	}
示例#9
0
 void Awake()
 {
     // Set up references
     playerBehavior = GetComponent<PlayerBehavior>();
     playerMovement = GetComponent<PlayerMovement>();
     realtimeCamera = References.realtimeCamera.GetComponent<PlayerCameraRotation>();
     events = EventSystem.current;
 }
	// Use this for initialization
	void Start () {
		worldCamera = GetComponentInChildren<Camera>();
		eventSystem = GameObject.FindObjectOfType<EventSystem>();
		playerInteratableController = GameObject.FindObjectOfType<PlayerInteractableController>();
		bossStatusController = GameObject.FindObjectOfType<BossStatusController>();

		lastKnownPosition = transform.position;
	}
示例#11
0
    void Awake()
    {

        //Fetch the current event system
        eventSystem = EventSystem.current;

        handler = this;
    }
    void Start()
    {
        system = EventSystem.current;

        field = GetComponent<InputField>();

        //field.OnSubmit(new UnityEngine.Events.UnityAction<string>(OnSubmitField));
    }
示例#13
0
 // Use this for initialization
 public override void OnStartClient () {
     input = GameObject.Find("ChatInput");
     chat = GameObject.Find("Chat").GetComponent<ChatControl>();
     eventSystem = GameObject.Find("EventSystem").GetComponent<EventSystem>();
     input.GetComponent<InputField>().Select();
     input.GetComponent<InputField>().OnPointerClick(new PointerEventData(EventSystem.current));
     input.SetActive(false);
     myAnimator = GetComponent<Animator>();
 }
示例#14
0
 void OnEnable()
 {
     Debug.Log("Unit Handler turned on");
     ev = this.GetComponentInParent<EventSystem>();
     ev.GetComponentInParent<PhysicsRaycaster>();
     unitPathRender = GetComponentInChildren<LineRenderer>();
     Instantiate(selector);
     selectScript = selector.GetComponent<Selector>();
 }
    void Start()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;

        eventSystem = EventSystem.current;

        eventSystem.SetSelectedGameObject(firstSelectElement);
    }
示例#16
0
    void Awake()
    {
        if (m_instance == null)
        {
            m_instance = FindObjectOfType<EventSystem>();
        }

        m_Subscribers = new Dictionary<string, Dictionary<ISubscriber, CallBack>>();
    }
示例#17
0
 // Use this for initialization
 void Start()
 {
     cardboardHead = Camera.main.GetComponent<StereoController>().Head;
     gazeInput = GameObject.FindGameObjectWithTag ("EventSystem").GetComponent<GazeInputModule>();
     EventSystemManager = GameObject.FindGameObjectWithTag ("EventSystem").GetComponent<EventSystem> ();
     eventSystem = new PointerEventData (EventSystem.current);
     loader = GameObject.FindGameObjectWithTag ("Clicker");
     loadFill = loader.GetComponent<Image> ();
 }
示例#18
0
 // Use this for initialization
 void Start()
 {
     events = GameObject.Find ("EventSystem").GetComponent<EventSystem> ();
     for (int i = 0; i < screens.Length; i++) {
         if (i != 0)
             screens[i].SetActive (false);
         else
             screens[i].SetActive (true);
     }
 }
示例#19
0
文件: menu.cs 项目: RazorX2/vrgame
 void Start()
 {
     paused = false;
     menuscreen = GameObject.FindGameObjectWithTag ("Menu");
     menuscreen.SetActive (false);
     myEventSystem = GameObject.Find("EventSystem").GetComponent<UnityEngine.EventSystems.EventSystem> ();
     GameObject[] shooters = GameObject.FindGameObjectsWithTag("Shooter");
     left = l.GetComponent<basic_shoot>().controller;
     right = r.GetComponent<basic_shoot>().controller;
 }
示例#20
0
 // Use this for initialization
 void Start()
 {
     selection = GameObject.Find("EventSystem").GetComponent<EventSystem>();
     for (int i = 0; i < screens.Count; i++) {
         if (i == 0)
             screens[i].SetActive (true);
         else
             screens[i].SetActive (false);
     }
 }
示例#21
0
 private void CreateEventSystem()
 {
     m_objEventSystem = new GameObject();
     m_objEventSystem.name = "EventSystem";
     m_objEventSystem.layer = GameLayer.UI;
     m_objEventSystem.transform.SetParent(m_transRootCanvas, false);
     m_compEventSystem = m_objEventSystem.AddComponent<EventSystem>();
     m_compSIModule = m_objEventSystem.AddComponent<StandaloneInputModule>();
     m_compTIModule = m_objEventSystem.AddComponent<TouchInputModule>();
 }
	public EventSystem eventSystem; //Added by Alisdair 14/9/14

	void Start()
	{
		//Create a reference to the Game
		gameController = GameObject.FindWithTag ("GameController").GetComponent<Game>();
		
		//Create a reference to the GameController's InputHandler
		inputHandlerController = GameObject.FindWithTag ("GameController").GetComponent<InputHandler> ();
		ioController = GameObject.FindWithTag ("GameController").GetComponent<InputOutput> ();

		//Find the event system Added By Alisdair 14/9/14
		eventSystem = GameObject.FindWithTag ("EventSystem").GetComponent<EventSystem>();
	}
示例#23
0
    void Awake()
    {
        _transform = transform;

        _meshParent = GameObject.Find("Meshes");
        _editPointsParent = GameObject.Find("EditPoints");

        _editPoints = new List<Vector3>();
        _meshList = new MeshList(_meshParent, meshPrefab);
        _fov = new FOV(_transform);
        _eventSystem = GameObject.Find("EventSystem").GetComponent<EventSystem>();
    }
示例#24
0
    void Start()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;
        singleplayerScript = GameObject.FindObjectOfType (typeof(Singleplayer)) as Singleplayer;

        eventSystem = EventSystem.current;

        eventSystem.SetSelectedGameObject(firstSelectElement);

        singleplayerScript.SetWinner (masterScript.GetCharacter(2));
        singleplayerScript.UpdateRound ();
    }
示例#25
0
    void Start()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;

        eventSystem = EventSystem.current;

        eventSystem.SetSelectedGameObject(firstSelectElement);

        startPos = credits.position;

        startTime = Time.time;

        StartCoroutine (ScrollNames ());
    }
示例#26
0
    void Awake()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;

        singleplayer = (masterScript.GetPlayerType (2) == "Ai") ? true : false;
        if (singleplayer) singleplayerScript = GameObject.FindObjectOfType (typeof(Singleplayer)) as Singleplayer;

        eventSystem = EventSystem.current;

        gameScript = GameObject.FindObjectOfType (typeof(Game)) as Game;

        healthBarP1 = matchUI.transform.FindChild ("Health_P1").FindChild ("healthbar").GetComponent<Image> ();
        healthBarP2 = matchUI.transform.FindChild ("Health_P2").FindChild ("healthbar").GetComponent<Image> ();
        energyBarP1 = matchUI.transform.FindChild ("Energy_P1").FindChild ("specialbar").GetComponent<Image> ();
        energyBarP2 = matchUI.transform.FindChild ("Energy_P2").FindChild ("specialbar").GetComponent<Image> ();
    }
    void Start()
    {
        m_MenuCanvas.enabled = true;
        m_OptionsCanvas.enabled = false;

        for (int i = 0; i < m_MenuCanvas.transform.childCount; i++)
        {
            m_MenuCanvas.transform.GetChild(i).gameObject.SetActive(true);
        }

        for (int i = 0; i < m_OptionsCanvas.transform.childCount; i++)
        {
            m_OptionsCanvas.transform.GetChild(i).gameObject.SetActive(false);
        }

        m_EventSystem = GameObject.FindGameObjectWithTag("Event System").GetComponent<EventSystem>(); 
    }
示例#28
0
    void Awake()
    {
        _camera = GetComponent<Camera>();

        _topLimit = 0;
        _leftLimit = 0;
        _bottomLimit = -MapGrid.Size.Y * MapGrid.CellSize.y;
        _rightLimit = MapGrid.Size.X * MapGrid.CellSize.x;

        _pixelW = Screen.width;
        _pixelH = Screen.height;
        _aspect = _pixelW / (float)_pixelH;
        _defaultOrthoSize = 3.5f * _pixelH / (2*Screen.dpi);
        UpdateMaxOrthoSize();
        SetOrthoSize(_defaultOrthoSize);
        SetPos(new Vector3(0,0,-10));

        _eventSystem = GameObject.FindGameObjectWithTag("EventSystem").GetComponent<EventSystem>();
    }
示例#29
0
    // Use this for initialization
    void Start()
    {
        base.Init();

        system = EventSystem.current;

        errorText = GameObject.Find("ErrorText").GetComponent<Text>();
        userField = GameObject.Find("usernameEdit").GetComponent<InputField>();
        passField = GameObject.Find("passwordEdit").GetComponent<InputField>();

        UserManager.Instance.registerCallback(UserOperation.LOGIN, (object obj) =>
        {
            funcQueue.Enqueue(() => {
                LoginReply packet = (LoginReply)obj;

                LoginStatus loginStatus = (LoginStatus)packet.response;

                string loginmessage = string.Empty;

                switch(loginStatus)
                {
                    case LoginStatus.VALID:
                        errorText.text = "";
                        Application.LoadLevel("charSelect");
                        break;
                    case LoginStatus.NOT_EXIST:
                        userField.text = "";
                        passField.text = "";
                        errorText.text =  "Username or password invalid";
                        break;
                    case LoginStatus.ERROR:
                        userField.text = "";
                        passField.text = "";
                        errorText.text = "There was an error";
                        break;
                    default:
                    break;
                }

            });
        });
    }
    private void Start()
    {
        m_EventSystem = FindObjectOfType<EventSystem>();

        m_AudioSource = GetComponent<AudioSource>();

        m_EmailInputValue = m_LoginPanel.GetChild(0).GetComponent<InputField>();

        m_PasswordInputValue = m_LoginPanel.GetChild(1).GetComponent<InputField>();
        m_PasswordInputValue.inputType = InputField.InputType.Password;

        m_RememberToggle = m_LoginPanel.GetChild(2).GetComponent<Toggle>();

        m_LoginButton = m_LoginPanel.GetChild(3).GetComponent<Button>();
        m_LoginButton.onClick.RemoveAllListeners();
        m_LoginButton.onClick.AddListener(delegate { Login(); });

        m_EmailInputValue.text = GetEmailIfRemember();

        m_NoAction = new UnityAction(Cancel);
    }
    public void OnCalledThroughInspector()
    {
        EventSystem es = GameObject.Find("EventSystem").GetComponent <EventSystem>();

        es.SetSelectedGameObject(whichButtonIsFirstSelected);
    }
示例#32
0
 public SourceRotationEventData(EventSystem eventSystem) : base(eventSystem)
 {
 }
示例#33
0
        public override void Begin()
        {
            EventSystem.Attach("user:login", new AsyncEventCallback(async metadata =>
            {
                var player          = new PlayerList()[metadata.Sender];
                var steam           = player.Identifiers.FirstOrDefault(self => self.StartsWith("steam:"))?.ToString();
                var connectedBefore = true;

                using (var context = new StorageContext())
                    using (var transaction = context.BeginTransaction())
                    {
                        var user       = context.Users.FirstOrDefault(self => self.SteamId == steam);
                        var connection = new Tuple <string, DateTime>(player.EndPoint, DateTime.Now);

                        if (user == null)
                        {
                            user = new AtlasUser
                            {
                                Seed              = Seed.Generate(),
                                SteamId           = steam,
                                Role              = Role.Member,
                                ConnectionHistory = new List <Tuple <string, DateTime> >(),
                                Metadata          = new UserMetadata()
                            };

                            connectedBefore = false;
                        }

                        user.Handle         = int.Parse(player.Handle);
                        user.LastName       = player.Name;
                        user.LatestActivity = DateTime.Now;

                        var last = user.ConnectionHistory.LastOrDefault();

                        if (last == null || last.Item1 != connection.Item1)
                        {
                            user.ConnectionHistory.Add(connection);
                        }

                        context.Users.AddOrUpdate(user);

                        await context.SaveChangesAsync();

                        transaction.Commit();

                        Logger.Info(connectedBefore
                        ? $"[User] [{user.Seed}] [{user.LastName}] Has connected to the server ({connection.Item1})"
                        : $"[User] [{steam}] [{player.Name}] Has connected for the first time ({connection.Item1})");

                        Atlas.ActiveUsers.Add(user);

                        return(user);
                    }
            }));

            EventSystem.Attach("user:save", new AsyncEventCallback(async metadata =>
            {
                await Atlas.Lookup(metadata.Sender).Save();

                return(null);
            }));

            EventSystem.Attach("user:fetch", new EventCallback(metadata =>
            {
                var seed = metadata.Find <string>(0);

                return(Atlas.ActiveUsers.FirstOrDefault(self => self.Seed == seed));
            }));

            EventSystem.Attach("user:postupdates", new EventCallback(metadata =>
            {
                var user = metadata.Find <AtlasUser>(0);

                Atlas.ActiveUsers.RemoveAll(self => self.Seed == user.Seed);
                Atlas.ActiveUsers.Add(user);

                return(null);
            }));

            EventSystem.Attach("user:redirect", new EventCallback(metadata =>
            {
                EventSystem.Send(metadata.Find <string>(1), metadata.Find <int>(0), metadata.AsEnumerable().Skip(2).ToArray());

                return(null);
            }));

            Atlas.EventRegistry["playerDropped"] += new Action <Player, string>(OnUserDisconnect);
        }
示例#34
0
    private void Start()
    {
        eventSystem = FindObjectOfType <EventSystem>();

        StartCoroutine(SelectFirstSelectable());
    }
 /// <summary>
 /// Initializes a new <see cref="IntentEventData"/>.
 /// </summary>
 /// <param name="eventSystem">
 /// The event system that the event should attach to.
 /// </param>
 public IntentEventData(EventSystem eventSystem) : base(eventSystem)
 {
 }
 void Awake()
 {
     _eventSystem      = GetComponentInChildren <EventSystem>();
     _canvasController = GetComponentInChildren <DestructorCanvasController>();
 }
示例#37
0
		// Use this for initialization
		void Start () {
			eventSystem = GetComponentInParent<EventSystem> ();
		}
示例#38
0
 private void Destroy(DefaultEvent events)
 {
     EventSystem.DisconnectObject(Handle);
 }
 public Pointer3DEventData(Pointer3DRaycaster ownerRaycaster, EventSystem eventSystem) : base(eventSystem)
 {
     raycaster = ownerRaycaster;
     Pointer3DInputModule.AssignPointerId(this);
 }
示例#40
0
 public TouchInputContext(MonoBehaviour behaviour, EventSystem eventSystem) :
     base(behaviour, eventSystem)
 {
 }
 void Start()
 {
     eventSystem = EventSystem.current;
     StartCoroutine(SetupKeys());
 }
 private void Start()
 {
     m_Raycaster   = GameObject.Find("Canvas").GetComponent <GraphicRaycaster>();
     m_EventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();
 }
 // Use this for initialization
 void Start()
 {
     status.enabled = false;
     system         = EventSystem.current;
 }
示例#44
0
 public BaseInputEventData(EventSystem eventSystem) : base(eventSystem)
 {
 }
示例#45
0
    private void OnDisable()
    {
        EventSystem <EnemySpawnedEvent> .UnregisterListener(OnEnemySpawned);

        EventSystem <EnemyDeathEvent> .UnregisterListener(OnEnemyDeath);
    }
示例#46
0
    void Start()
    {
        eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();

        defaultButton = PauseCanvas.transform.FindDeepChild("Resume Button").GetComponent <Button>();
    }
示例#47
0
 private void Start()
 {
     system = EventSystem.current;
 }
 public SpeechKeywordRecognizedEventData(EventSystem eventSystem) : base(eventSystem)
 {
 }
示例#49
0
    private UIItemSlot toSlot;   // The slot we're trying to put an item into.

    private void Awake()
    {
        raycaster   = GetComponent <GraphicRaycaster>();
        eventsystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();
    }
示例#50
0
    public bool initIngameGlobalManageVariables()
    {
        //Debug.Log("here Init");


        // LevelManager
        GameObject tmpObj = GameObject.Find("LevelManager");

        if (tmpObj)
        {
            _levelManager = tmpObj.GetComponent <LevelManager> ();
            saveAndLoadManager._levelManager = _levelManager;
        }

        // cameraViewer3D
        tmpObj = GameObject.Find("CamShowObject");
        if (tmpObj)
        {
            cameraViewer3D = tmpObj.GetComponent <investigationCam> ();
        }

        // canvasPlayerInfos
        tmpObj = GameObject.Find("Canvas_PlayerInfos");
        if (tmpObj)
        {
            canvasPlayerInfos = tmpObj.GetComponent <UIVariousFunctions> ();

            // Reticule
            tmpObj = GameObject.Find("Reticule");
            if (tmpObj)
            {
                if (!b_DesktopInputs)
                {               // Deactivate Reticule if Mobile input are used
                    tmpObj.SetActive(false);
                    reticule = null;
                }
                else
                {
                    tmpObj.SetActive(true);
                    reticule = tmpObj;
                }
            }

            tmpObj = GameObject.Find("ReticuleJoystick");
            if (tmpObj)
            {
                reticuleJoystick      = tmpObj;
                reticuleJoystickImage = reticuleJoystick.transform.GetChild(0);
                _joystickReticule     = reticuleJoystick.GetComponent <JoystickReticule>();

                if (!b_DesktopInputs && reticuleJoystickImage && reticuleJoystickImage.gameObject.activeSelf)
                {
                    reticuleJoystickImage.gameObject.SetActive(false);
                }
            }

            StartCoroutine(InitCanvasMenu());
        }



        // canvasMainMenu
        tmpObj = GameObject.Find("Canvas_MainMenu");
        if (tmpObj)
        {
            canvasMainMenu = tmpObj.GetComponent <Menu_Manager> ();
        }

        switchKeyboardJoystick();

        // canvasLoadingScreen
        tmpObj = GameObject.Find("Canvas_LoadingScreen");
        if (tmpObj)
        {
            canvasLoadingScreen = tmpObj.GetComponent <Menu_Manager> ();
        }

        // Game_ObjectReader
        tmpObj = GameObject.Find("Game_ObjectReaderConnect");
        if (tmpObj)
        {
            Game_ObjectReader = tmpObj.GetComponent <ObjectReaderConnect>().Game_ObjectReaderConnect.GetComponent <ingameMultiPageText> ();
        }

        // canvasMobileInputs
        GameObject tmpMobileCanvas = GameObject.Find("mobileCanvas");

        if (tmpMobileCanvas)
        {
            canvasMobileInputs = tmpMobileCanvas.GetComponent <canvasMobileConnect>().canvas_Mobile;
            if (b_DesktopInputs)
            {
                canvasMobileInputs.SetActive(false);
            }                                                                       // Deactivate Mobile canvas if Desktop input are used
            else
            {
                canvasMobileInputs.SetActive(true);
            }
        }

        lastUIButtonSelected = null;
        navigationButtonList.Clear();

        // Find the event System
        GameObject tmpEventSys = GameObject.Find("EventSystem");

        if (tmpEventSys)
        {
            eventSys = tmpEventSys.GetComponent <EventSystem> ();
        }

        // InitInputs

        initInputsValues();


        // inputListOfStringGamepad


        // audioMenu
        tmpObj = GameObject.Find("audioMenu");
        if (tmpObj)
        {
            audioMenu = tmpObj.GetComponent <AudioSource> ();
        }

        // audioMenuClips
        tmpObj = GameObject.Find("audioMenu");
        if (tmpObj)
        {
            audioMenuClips = tmpObj.GetComponent <audioMenuClipList> ();
        }


        // voiceOverManager
        tmpObj = GameObject.Find("VoiceOver_Manager");
        if (tmpObj)
        {
            voiceOverManager = tmpObj.GetComponent <VoiceOver_Manager> ();
        }



        currentPlayerDiaryList.Clear();
        currentPlayerInventoryList.Clear();
        currentPlayerInventoryObjectVisibleList.Clear();

        // Connect script mobileInputsFingerMovement to canvasMobileInputs
        if (GetComponent <mobileInputsFingerMovement> () && !b_DesktopInputs)
        {
            //Debug.Log ("Here Ok");
            if (canvasMobileInputs)
            {
                GetComponent <mobileInputsFingerMovement> ().m_Raycaster = canvasMobileInputs.GetComponent <GraphicRaycaster> ();
            }
            if (canvasPlayerInfos)
            {
                GetComponent <mobileInputsFingerMovement> ().listRaycaster[0] = canvasPlayerInfos.GetComponent <GraphicRaycaster> ();
            }
            if (canvasMobileInputs)
            {
                GetComponent <mobileInputsFingerMovement> ().listRaycaster[1] = canvasMobileInputs.GetComponent <GraphicRaycaster> ();
            }
            if (canvasMainMenu)
            {
                GetComponent <mobileInputsFingerMovement> ().listRaycaster[2] = canvasMainMenu.GetComponent <GraphicRaycaster> ();
            }
        }

        // currentPlayer
        b_bodyMovement = true;

        tmpObj = GameObject.Find("Character");
        if (tmpObj)
        {
            currentPlayer = tmpObj;
        }


        if (tmpMobileCanvas && tmpMobileCanvas.GetComponent <canvasMobileConnect> ())
        {
            tmpMobileCanvas.GetComponent <canvasMobileConnect>().initializedCanvasMobile();
        }

        gameObject.GetComponent <focusCamEffect> ().Init();



        // language Choice
        tmpObj = GameObject.Find("OptionsManager");
        if (tmpObj)
        {
            tmpObj.GetComponent <GameOptionsManager>().initData();
        }



        return(true);
    }
示例#51
0
 void OnLevelWasLoaded()
 {
     DontDestroyOnLoad(this.gameObject);
     system = EventSystem.current;        // EventSystemManager.currentSystem;
 }
示例#52
0
文件: Program.cs 项目: MrDurank/Miki
        /// <summary>
        /// The program runs all discord services and loads all the data here.
        /// </summary>
        public void LoadDiscord()
        {
            Global.redisClient = new StackExchangeRedisCacheClient(new ProtobufSerializer(), Global.Config.RedisConnectionString);

            if (!Global.Config.IsPatreonBot)
            {
                WebhookManager.Listen("webhook");

                WebhookManager.OnEvent += async(eventArgs) =>
                {
                    Console.WriteLine("[webhook] " + eventArgs.auth_code);
                };
            }

            bot = new Bot(new ClientInformation()
            {
                Name       = "Miki",
                Version    = "0.6",
                Token      = Global.Config.Token,
                ShardCount = Global.Config.ShardCount,
                DatabaseConnectionString = Global.Config.ConnString
            });

            var eventSystem = EventSystem.Start(bot);

            if (!string.IsNullOrWhiteSpace(Global.Config.SharpRavenKey))
            {
                Global.ravenClient = new SharpRaven.RavenClient(Global.Config.SharpRavenKey);
            }

            if (!string.IsNullOrWhiteSpace(Global.Config.DatadogKey))
            {
                var dogstatsdConfig = new StatsdConfig
                {
                    StatsdServerName = Global.Config.DatadogHost,
                    StatsdPort       = 8125,
                    Prefix           = "miki"
                };
                DogStatsd.Configure(dogstatsdConfig);
            }

            eventSystem.AddCommandDoneEvent(x =>
            {
                x.Name         = "datadog-command-done";
                x.processEvent = async(msg, cmd, success, t) =>
                {
                    if (!success)
                    {
                        DogStatsd.Counter("commands.error.rate", 1);
                    }

                    DogStatsd.Counter("commands.count", 1, 1, new[]
                                      { $"commandtype:{cmd.Module.Name.ToLowerInvariant()}", $"commandname:{cmd.Name.ToLowerInvariant()}" });
                    DogStatsd.Histogram("commands.time", t, 0.1, new[]
                                        { $"commandtype:{cmd.Module.Name.ToLowerInvariant()}", $"commandname:{cmd.Name.ToLowerInvariant()}" });
                };
            });

            EventSystem.Instance.RegisterPrefixInstance(">")
            .RegisterAsDefault();

            eventSystem.RegisterPrefixInstance("miki.", false);

            bot.MessageReceived += Bot_MessageReceived;

            bot.OnError = async(ex) => Log.Message(ex.ToString());
            eventSystem.AddDeveloper(121919449996460033);

            foreach (ulong l in Global.Config.DeveloperIds)
            {
                eventSystem.AddDeveloper(l);
            }

            bot.Client.JoinedGuild += Client_JoinedGuild;
            bot.Client.LeftGuild   += Client_LeftGuild;

            bot.ShardConnect    += Bot_OnShardConnect;
            bot.ShardDisconnect += Bot_OnShardDisconnect;
        }
示例#53
0
 // Start is called before the first frame update
 void Start()
 {
     gameController = GameController.GetComponent <GameController>();
     eventSystem    = GetComponentInChildren <EventSystem>();
 }
示例#54
0
 /// <inheritdoc />
 public MixedRealityPointerEventData(EventSystem eventSystem) : base(eventSystem)
 {
 }
示例#55
0
 void Start()
 {
     loadingIndicator.SetActive(false);
     system = EventSystem.current;
 }
示例#56
0
        internal void Update(Touch touch, EventSystem eventSystem)
        {
            switch (touch.phase)
            {
            case TouchPhase.Began:
            {
                if (begin)
                {
                    Debug.LogError("invalid Begin");
                    return;
                }
                if (eventSystem != null && eventSystem.IsPointerOverGameObject(touch.fingerId))
                {
                    return;
                }
                begin    = true;
                beginPos = touch.position;
                var e = new InputEvent()
                {
                    sequenceId = this.sequenceId,
                    id         = this.id,
                    type       = InputEventType.Begin,
                    position   = touch.position,
                    sender     = this
                };
                this.id++;
                beginStream.OnNext(e);
            }
            break;

            case TouchPhase.Moved:
            {
                if (!begin)
                {
                    return;
                }
                var e = new InputEvent()
                {
                    sequenceId = this.sequenceId,
                    id         = this.id,
                    type       = InputEventType.Move,
                    position   = touch.position,
                    sender     = this
                };
                this.id++;
                moveStream.OnNext(e);
            }
            break;

            case TouchPhase.Ended:
            {
                if (!begin)
                {
                    return;
                }
                begin = false;
                var e = new InputEvent()
                {
                    sequenceId = this.sequenceId,
                    id         = this.id,
                    type       = InputEventType.End,
                    position   = touch.position,
                    sender     = this
                };
                this.id = 0;
                endStream.OnNext(e);
                this.sequenceId++;
            }
            break;

            default:
                break;
            }
        }
示例#57
0
 public GamePadEventData(EventSystem eventSystem) : base(eventSystem)
 {
 }
 public WindowStack(Canvas canvas, EventSystem eventSystem)
 {
     rootCanvas       = canvas;
     this.eventSystem = eventSystem;
 }
示例#59
0
 /// <summary>
 /// Grabs reference to the current EventSystem
 /// </summary>
 protected virtual void Start()
 {
     EventSystem = EventSystem.current;
 }
示例#60
0
 private void Start()
 {
     gameOverUi.enabled = false;
     btn      = GameObject.Find("PlayAgainButton").GetComponent <Button>();
     eventSys = GameObject.Find("EventSystem").GetComponent <EventSystem>();
 }