IEnumerator Startup() { ViewController.GetInstance().Initialize(ViewAnchorRef.transform); UserDataController.GetInstance().Initialize(); while (UserDataController.GetInstance().ContactsUsers == null) { yield return(null); } SoundManager.GetInstance(); yield return(new WaitForSeconds(.1f)); StartCoroutine(NetworkController.GetInstance().Connect()); SpeechController.GetInstance().Initialize(); PhotoController.GetInstance().Initialize(); CheatController.GetInstance().Initialize(ViewAnchorRef.transform); ContactsList cl = ViewController.GetInstance().CurrentView.GetComponent <ContactsList>(); cl.Initialize(); //Initiate The Singletons //Transaction<List<TcgCard>> t = new Transaction<List<TcgCard>>(); }
void ClickHandler() { SoundManager.GetInstance().PlaySingle("SoundFX/music_marimba_chord"); //RotateArrow(Test.transform.Find("Circle").GetComponent<RectTransform>().localRotation, testImage0.sprite, Test.GetComponent<ContactTag>().TagData); rotateAction(this.gameObject); UserDataController.GetInstance().CalleeUserName = Model.Name; UserDataController.GetInstance().CalleeImage = Model.Image; }
/* * public void ChangeState(ContactsList.CurrentState State) * { * if (State == ContactsList.CurrentState.ContactList) * { * AcceptingInput = true; * transform.Find("Albums").gameObject.SetActive(false); * transform.Find("Requests").gameObject.SetActive(true); * transform.Find("Tab/TimeToCall").gameObject.SetActive(true); * transform.Find("Tab/LastTalked").gameObject.SetActive(true); * transform.Find("Tab/Calling").gameObject.SetActive(false); * } * * if (State == ContactsList.CurrentState.Calling) * { * AcceptingInput = false; * transform.Find("Albums").gameObject.SetActive(false); * transform.Find("Requests").gameObject.SetActive(false); * transform.Find("Tab/TimeToCall").gameObject.SetActive(false); * transform.Find("Tab/LastTalked").gameObject.SetActive(false); * transform.Find("Tab/Calling").gameObject.SetActive(true); * } * * if (State == ContactsList.CurrentState.Calling) * { * AcceptingInput = false; * transform.Find("Albums").gameObject.SetActive(false); * transform.Find("Requests").gameObject.SetActive(false); * transform.Find("Tab/TimeToCall").gameObject.SetActive(false); * transform.Find("Tab/LastTalked").gameObject.SetActive(false); * transform.Find("Tab/Calling").gameObject.SetActive(true); * } * } */ public void SetUserPopsicleInfo(ContactModel contactModel) { NameText.text = contactModel.Name; TimeToCallText.text = contactModel.TimeToCall; LastTalkedText.text = contactModel.LastTalked; if (UserDataController.GetInstance().ActiveUserType == UserDataController.UserType.Caregiver) { List <LayoutElement> les = RequestedOfMeScroll.content.GetComponent <VerticalLayoutGroup>().GetComponentsInChildren <LayoutElement>().ToList(); foreach (LayoutElement le in les) { Destroy(le.gameObject); } foreach (string req in contactModel.RequestedOfMe) { GameObject go = GameObject.Instantiate <GameObject>(requestedOfMeItemPrefab, RequestedOfMeScroll.content.transform); go.GetComponent <RectTransform>().localScale = Vector3.one; go.transform.Find("Text").GetComponent <Text>().text = req; } les = RequestedOfOthersScroll.content.GetComponent <VerticalLayoutGroup>().GetComponentsInChildren <LayoutElement>().ToList(); foreach (LayoutElement le in les) { Destroy(le.gameObject); } foreach (string req in contactModel.RequestedOfOthers) { GameObject go = GameObject.Instantiate <GameObject>(requestedOfOthersItemPrefab, RequestedOfOthersScroll.content.transform); go.GetComponent <RectTransform>().localScale = Vector3.one; go.transform.Find("Text").GetComponent <Text>().text = req; } } else { ScrollRect albumScrollRect = SeniorAlbums.transform.Find("Scroll View").GetComponent <ScrollRect>(); List <LayoutElement> les = albumScrollRect.content.transform.GetComponentsInChildren <LayoutElement>().ToList(); foreach (LayoutElement le in les) { Destroy(le.gameObject); } GameObject albumImagePrefab = Resources.Load <GameObject>("Prefabs/ContactsScreen/AlbumImage"); foreach (string photoName in contactModel.Photos) { Regex re = new Regex(@"([a-zA-Z]+)(\d+)"); Match result = re.Match(photoName); string alphaPart = result.Groups[1].Value; string numberPart = result.Groups[2].Value; Sprite photoSprite = PhotoController.GetInstance().GetPhoto(alphaPart, photoName); GameObject albumImageInstance = Instantiate <GameObject>(albumImagePrefab); albumImageInstance.GetComponent <Image>().sprite = photoSprite; albumImageInstance.transform.SetParent(albumScrollRect.content.transform); albumImageInstance.GetComponent <RectTransform>().localScale = Vector3.one; //albumScrollRect.Rebuild(CanvasUpdate.Prelayout); } } }
private void Start() { View.anchoredPosition = new Vector2(View.anchoredPosition.x, -406); UserDataController.UserType userType = UserDataController.GetInstance().ActiveUserType; if (userType == UserDataController.UserType.Senior) { CaregiverRequests.SetActive(false); SeniorAlbums.SetActive(true); transform.Find("Bottom").gameObject.SetActive(false); } }
void LoadData() { if (UserDataController.GetInstance().ActiveUserType == UserDataController.UserType.Caregiver) { model = UserDataController.GetInstance().ContactsUsers.Caregiver.Contacts; } else { model = UserDataController.GetInstance().ContactsUsers.Senior.Contacts; } }
// Use this for initialization void Start() { SoundManager.GetInstance().StopAllLoopingSoundEffects(); remoteUserPanel = transform.Find("Panel").gameObject; remoteUserPanel.transform.Find("Callee").GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/Photos/Profile/" + UserDataController.GetInstance().CalleeImage); transform.Find("BottomBar/Tab/Name").GetComponent <Text>().text = UserDataController.GetInstance().CalleeUserName; if (UserDataController.GetInstance().ActiveUserType == UserDataController.UserType.Senior) { transform.Find("BottomBar/InCall/Mic").gameObject.SetActive(false); transform.Find("BottomBar/InCall/Sound").gameObject.SetActive(false); } CalleeCanvasZoom = remoteUserPanel.GetComponent <RectTransform>(); calleeCanvas = remoteUserPanel.transform.Find("VideoCallee").GetComponent <CanvasRenderer>(); CalleeOriginalSize = remoteUserPanel.transform.Find("VideoCallee").GetComponent <RectTransform>().sizeDelta; CallTime = transform.Find("BottomBar/Tab/Calling").GetComponent <Text>(); if (UserDataController.GetInstance().ActiveUserType == UserDataController.UserType.Senior) { transform.Find("BottomBar/InCall/Sound").gameObject.SetActive(false); transform.Find("BottomBar/InCall/Mic").gameObject.SetActive(false); } StartCoroutine(CallTimer()); localUserPanel = transform.Find("UserPanel").gameObject; UserPanelRef = localUserPanel.AddComponent <UserPanel>(); endCall = transform.Find("BottomBar/InCall/EndCall").GetComponent <Button>(); endCall.onClick.AddListener(() => { SoundManager.GetInstance().PlaySingle("SoundFX/pop_drip"); videoCall.GetComponent <VideoCall>().Restart(); }); GameObject videoCallPrefab = Resources.Load <GameObject>("Prefabs/SeniorCall/VideoCall"); videoCall = GameObject.Instantiate <GameObject>(videoCallPrefab); videoCall.transform.SetParent(this.transform); videoCall.transform.localPosition = Vector3.zero; StartCoroutine(videoCall.GetComponent <VideoCall>().SetupVideo(OnVideoStart)); DragSlot dragComponent = transform.Find("SharedPhoto/DragSlot").gameObject.AddComponent <DragSlot>(); dragComponent.method += PhotoDragHandler; NetworkController.GetInstance().OnPhotoReceived += ReceivedNetworkPhoto; }
// Show is at y = 110 // Hidden is at y = 850 public void ShowScrollView() { SoundManager.GetInstance().PlaySingle("SoundFX/digi_plink"); if (IEShowScrollView != null) { StopCoroutine(IEShowScrollView); } IEShowScrollView = null; IEShowScrollView = coShowScrollView(); if (UserDataController.GetInstance().ActiveUserType != UserDataController.UserType.Senior) { StartCoroutine(IEShowScrollView); } }
void ToggleUserType() { var udc = UserDataController.GetInstance(); if (udc.ActiveUserType == UserDataController.UserType.Caregiver) { udc.SetUserType(UserDataController.UserType.Senior); } else { udc.SetUserType(UserDataController.UserType.Caregiver); } UserTypeCheat.transform.Find("Text").GetComponent <Text>().text = "RESTART to see changes"; UserTypeCheat.GetComponent <Button>().onClick.RemoveListener(ToggleUserType); }
// Use this for initialization void Start() { SoundManager.GetInstance().PlaySingle("SoundFX/Ringing_Phone", true); ieRotateDotRings = RotateDotRings(); StartCoroutine(ieRotateDotRings); acceptButton = this.transform.Find("Panel/BottomBar/AcceptCall").GetComponent <Button>(); acceptButton.onClick.AddListener(() => { SoundManager.GetInstance().StopAllLoopingSoundEffects(); SoundManager.GetInstance().PlaySingle("SoundFX/pop_drip"); ViewController.GetInstance().CreateView("Prefabs/SeniorCall/SeniorCall"); }); declineButton = this.transform.Find("Panel/BottomBar/EndCall").GetComponent <Button>(); declineButton.onClick.AddListener(() => { SoundManager.GetInstance().StopAllLoopingSoundEffects(); SoundManager.GetInstance().PlaySingle("SoundFX/pop_drip"); StartCoroutine(StopRotatingDotRings()); }); if (UserDataController.GetInstance().ActiveUserType == UserDataController.UserType.Senior) { UserDataController.GetInstance().CalleeImage = "Linda"; UserDataController.GetInstance().CalleeImage = "Linda"; UserDataController.GetInstance().UserImage = "Emma"; UserDataController.GetInstance().UserName = "******"; } else { UserDataController.GetInstance().CalleeImage = "Emma"; UserDataController.GetInstance().CalleeImage = "Emma"; UserDataController.GetInstance().UserImage = "Linda"; UserDataController.GetInstance().UserName = "******"; } }
void Start() { ButtonComponent = transform.Find("Mask/Mask/BG").GetComponent <Button>(); ScrollView = this.transform.Find("Mask/ScrollView").GetComponent <RectTransform>(); ButtonComponent.onClick.AddListener(ShowScrollView); LocalViewCanvas = transform.Find("Mask/Mask/BG").GetComponent <CanvasRenderer>(); transform.Find("Mask/Mask/BG").GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/Photos/Profile/" + UserDataController.GetInstance().UserImage); VideoChat.localView = true; if (Application.platform == RuntimePlatform.Android) { LocalViewCanvas.GetComponent <RectTransform>().Rotate(new Vector3(0, 0, 90)); } PhotoController.GetInstance().OnActiveSetChanged += ForceOpenScrollView; }
public void Initialize() { LoadData(); MainPanel = this.GetComponent <RectTransform>().Find("Image").GetComponent <RectTransform>(); BubbleList = new List <GameObject>(); UserBubbleList = new List <GameObject>(); GameObject popsicle = UICreate.InstantiateRectTransformPrefab(Resources.Load <GameObject>("Prefabs/ContactsScreen/Popsicle"), MainPanel.GetComponent <RectTransform>()); _Popsicle = popsicle.GetComponent <Popsicle>(); GameObject prefab = Resources.Load <GameObject>("Prefabs/FrontPageButtons/MiddleDial"); MiddleDial = UICreate.InstantiateRectTransformPrefab(prefab, MainPanel.GetComponent <RectTransform>()); MiddleDial.GetComponent <RectTransform>().localScale = new Vector3(1.75f, 1.75f, 1); Button callButton = MiddleDial.transform.Find("CallButton").GetComponent <Button>(); callButton.onClick.AddListener(() => { SoundManager.GetInstance().PlaySingle("SoundFX/pop_drip"); SoundManager.GetInstance().PlaySingle("SoundFX/Ringing_Phone", true); if (UserDataController.GetInstance().ActiveUserType == UserDataController.UserType.Caregiver) { UserDataController.GetInstance().UserName = "******"; UserDataController.GetInstance().UserImage = "Linda"; } else { UserDataController.GetInstance().UserName = "******"; UserDataController.GetInstance().UserImage = "Emma"; } TransitionToCall(); callButton.onClick.RemoveAllListeners(); }); if (UserDataController.GetInstance().ActiveUserType == UserDataController.UserType.Caregiver) { AddBubbleToList(0, 0, model[0]); AddBubbleToList(-25, 25, model[1]); AddBubbleToList(25, -25, model[2]); AddContactListBubble(50, -50); AddContactAddBubble(-50, 50); } else { AddBubbleToList(0, 0, model[0]); AddBubbleToList(-25, 25, model[1]); AddBubbleToList(-50, 50, model[2]); AddBubbleToList(50, -50, model[3]); AddBubbleToList(25, -25, model[4]); AddContactListBubble(75, -75); AddContactAddBubble(-75, 75); } //FillWithData(); //Image img = BubbleList[2].transform.Find("Circle/ImageMask/Image").GetComponent<Image>(); //RotateArrow(BubbleList[2].transform.Find("Circle").GetComponent<RectTransform>().localRotation, img.sprite, model[2]); if (BubbleList.Count > 0) { BubbleList[0].GetComponent <Button>().onClick.Invoke(); } EnterAnimation(); }
public void Initialize(Transform canvasTransform) { this.CanvasTransform = canvasTransform; GameObject cheatPrefab = Resources.Load <GameObject>("Prefabs/CheatScreen"); CheatScreen = Instantiate(cheatPrefab, canvasTransform); //CheatScreen.SetActive(false); CheatScreen.GetComponent <RectTransform>().anchorMax = new Vector2(.5f, .5f); CheatScreen.GetComponent <RectTransform>().anchorMin = new Vector2(.5f, .5f); CheatScreen.GetComponent <RectTransform>().pivot = new Vector2(.5f, .5f); CheatScreen.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0); DebugCheat = CheatScreen.transform.Find("DebugCheat").gameObject; DebugCheat.GetComponent <Button>().onClick.AddListener(ToggleDebug); UserTypeCheat = CheatScreen.transform.Find("UserTypeCheat").gameObject; UserTypeCheat.GetComponent <Button>().onClick.AddListener(ToggleUserType); UserTypeCheat.transform.Find("Text").GetComponent <Text>().text = "UserType : " + UserDataController.GetInstance().ActiveUserType.ToString(); CheatScreen.GetComponent <Canvas>().enabled = false; }