public void Start(GameObject panel, GameObject rewardPanel, GameObject punishmentPanel, GameObject spammingText) { if (GlobalSettings.Gs == null) { GuiHandler.GoToMainMenu(); } else { switch (_myType) { case TaskType.Control: _taskSettings = GlobalSettings.Gs.ControlSettings; break; case TaskType.Reward: _taskSettings = GlobalSettings.Gs.RewardSettings; break; case TaskType.Punishment: _taskSettings = GlobalSettings.Gs.PunishmentSettings; break; default: throw new ArgumentOutOfRangeException(); } _spriteSettings = GlobalSettings.Gs.SpriteSettings; _threshold = GlobalSettings.Gs.Threshold; } SetPanels(panel, rewardPanel, punishmentPanel, spammingText); GetInformation(); InitValues(); }
void Start() { controller = GameObject.Find("GameController").GetComponent <GameController>(); rigidOfPlayer = gameObject.GetComponent <Rigidbody2D>(); handler = GameObject.Find("OnClickEvents").GetComponent <GuiHandler>(); firstPos = transform.position; }
//private static DatabaseContext _DBContext = new DatabaseContext(); //public static DatabaseContext DBContext //{ // get { return _DBContext; } // private set { _DBContext = value; } //} public static void BuildHandler(System.ComponentModel.ISynchronizeInvoke synchronizingObject) { _SynchronizingObject = synchronizingObject; if (_Handler != null) { _Handler.Dispose(); } logger.Info("Building new GuiHandler"); _Handler = new GuiHandler(_SynchronizingObject, Commands.IPC_DEFAULT_GUI_CLIENT_NAME, Commands.IPC_DEFAULT_HOST, Commands.IPC_DEFAULT_PORT); }
void Awake() { //maintain singleton pattern if (GuiHandler.Instance == null) { GuiHandler.Instance = this; } else if (GuiHandler.Instance != this) { Destroy(this.gameObject); } this.drawFunctions = new List <guiDraw>(); }
private void Start() { if (GlobalSettings.Gs == null) { GuiHandler.GoToMainMenu(); } else { _timeSettings = GlobalSettings.Gs.SpriteSettings.BaselineSpriteSettings; _infoDisplayTime = GlobalSettings.Gs.BaselineSettings.InfoDisplayTime; } _panel = gameObject; GetInformation(); InitValues(); }
private void Awake() { Instance = this; Progress.fillAmount = 0f; ProgressTxt.text = "0%"; TotalGames++; Time.timeScale = 1; TapTxt.SetActive(Storage.AmountPlayed < 4); if (Settings.GameType == 1) { //Crown.SetActive(false); //Completed.gameObject.SetActive(false); foreach (var o in P) { o.SetActive(false); } } }
// Use this for initialization public void Awake() { zeroPoint = new Vector3(0,0,0); lineTopSetup = GameObject.Find("LineSetupTop").GetComponent<LineSetupTop>(); controller = GameObject.Find("GameController").GetComponent<GameController>(); handler = GameObject.Find("OnClickEvents").GetComponent<GuiHandler>(); x = -12; y = Random.Range(-5, 0); lastY = y; GameObject linePart = Instantiate(curvesBotPrefab, zeroPoint, Quaternion.identity); lineRendererS = lineRendererSetup(linePart); colliderS = linePart.GetComponent<EdgeCollider2D>(); curveDrawer = linePart.GetComponent<BezierCurve2D>(); curveDrawer.drawQuadraticCurve(lineRendererS, 50, new Vector3(-17, 0, 0), new Vector3(-16, 0, 0), new Vector3(-15, 0, 0)); curveCollider = linePart.GetComponent<BezierCurve2DCollider>(); curveCollider.CreateColliderQuadraticCurve2D(colliderS, 50, new Vector3(-17, 0, 0), new Vector3(-16, 0, 0), new Vector3(-15, 0, 0)); colliderS.edgeRadius = 0.1f; }
public void Update() { _spacebarPressed = Input.GetKeyDown("space"); CheckSkipping(); _passedTime += Time.deltaTime * 1000; double threshold = UnityClient.Communicator.HandleServerParams(); if (Math.Abs(threshold) > float.Epsilon) { _threshold = threshold; } switch (_currentDisplayStatus) { case DisplayStatus.DisplayingInfo: var limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _taskSettings.InfoTime; if (_passedTime > limit) { if (_currentSprite != null) { SpriteHandler.Sh.DestroySprite(_currentSprite); } _currentInfo = _informationHolder.GetNextInformation(); _currentDisplayStatus = _currentInfo.NextDisplayStatus; _panel.GetComponentInChildren <Text>().text = _currentInfo.InfoText; _allowedSkipping = _currentInfo.Skippable; _passedTime = 0; } break; case DisplayStatus.DisplayResults: HandleUserInput(); if (_passedTime > _spriteSettings.GetTimeSettings(_currentSpriteType).SpriteDelayTime) { DisplayInfo(); _passedTime = 0; } break; case DisplayStatus.WaitToDisplaySprite: AntiSpamming.CheckForSpamming(_currentDisplayStatus, _spacebarPressed); HandleUserInput(); if (_passedTime > _spriteSettings.GetTimeSettings(_upcomingSpriteType).SpriteDelayTime) { _panel.GetComponentInChildren <Text>().text = ""; ShowSprite(); _passedTime = 0; } break; case DisplayStatus.DisplayingSprite: if (_passedTime > _spriteSettings.GetTimeSettings(_currentSpriteType).SpriteDisplayTime) { AntiSpamming.Clear(); RemoveSprite(); } HandleUserInput(); break; case DisplayStatus.WaitingUserInput: if (_spacebarPressed) { _currentDisplayStatus = DisplayStatus.DisplayingInfo; } break; case DisplayStatus.DisplayBoth: limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _taskSettings.InfoTime; if (_passedTime > limit) { if (_currentSprite != null) { SpriteHandler.Sh.DestroySprite(_currentSprite); } _currentInfo = _informationHolder.GetNextInformation(); _currentSprite = SpriteHandler.Sh.CreateSprite(_currentInfo.Type, _panel, Position.Above); _currentDisplayStatus = _currentInfo.NextDisplayStatus; _panel.GetComponentInChildren <Text>().text = _currentInfo.InfoText; _allowedSkipping = _currentInfo.Skippable; _passedTime = 0; } break; case DisplayStatus.GoToMainMenu: if (_passedTime > _taskSettings.InfoTime) { UnityClient.Communicator.Disconnect(); GuiHandler.GoToMainMenu(); } break; case DisplayStatus.GoToNextScene: limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _taskSettings.InfoTime; if (_passedTime > limit) { if (Randomness.Rand.NextDouble() < 0.5) { _punishmentPanel.SetActive(true); } else { _rewardPanel.SetActive(true); } _panel.SetActive(false); } break; default: throw new ArgumentOutOfRangeException(); } }
private void Update() { _spacebarPressed = Input.GetKeyDown("space"); CheckSkipping(); _passedTime += Time.deltaTime * 1000; switch (_currentDisplayStatus) { case DisplayStatus.DisplayingInfo: var limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _infoDisplayTime; if (_passedTime > limit) { _currentInfo = _informationHolder.GetNextInformation(); _currentDisplayStatus = _currentInfo.NextDisplayStatus; _panel.GetComponentInChildren <Text>().text = _currentInfo.InfoText; _allowedSkipping = _currentInfo.Skippable; _passedTime = 0; } break; case DisplayStatus.DisplayResults: DisplayResults(); _passedTime = 0; break; case DisplayStatus.WaitToDisplaySprite: limit = _currentInfo.DisplayTime != -1 ? _currentInfo.DisplayTime : _infoDisplayTime; if (_passedTime > limit) { _panel.GetComponentInChildren <Text>().text = ""; ShowSprite(); _waitingForUser = true; _passedTime = 0; } break; case DisplayStatus.DisplayingSprite: if (_passedTime > _timeSettings.SpriteDisplayTime) { RemoveSprite(); } HandleUserInput(); break; case DisplayStatus.WaitingUserInput: if (_spacebarPressed) { HandleUserInput(); } break; case DisplayStatus.DisplayBoth: break; case DisplayStatus.GoToMainMenu: if (_passedTime > _infoDisplayTime) { GuiHandler.GoToMainMenu(); } break; case DisplayStatus.GoToNextScene: if (_passedTime > _infoDisplayTime) { _panel.SetActive(false); PanelSrt.SetActive(true); } break; default: throw new ArgumentOutOfRangeException(); } }
public MainForm() { InitializeComponent(); _guiHandler = new GuiHandler(this); }