public MainPage(String token = null)
        {
            InitializeComponent();

            // Capture controlls
            Keyboard.RootControl = this;
            Mouse.RootControl    = this;

            // Social connect
            SocialController.Setup();

            if (!String.IsNullOrWhiteSpace(token))
            {
                SocialController.Connect(token);
            }

            // Create game
            game = new PeasGame(App.Current.IsRunningOutOfBrowser, 1280, 720);
            game.Attach(LayoutRoot);

            // Makes sure to redraw
            game.IsFixedTimeStep = false;

            // Make resizable
            this.SizeChanged += new SizeChangedEventHandler(MainPage_SizeChanged);
        }
Пример #2
0
    void Awake()
    {
        _controller = new SocialController(this);
        _controller.SendRequestFriendList();
        _controller.SendRequestMailList();
        _controller.SendRequestReportList();
        _friendActiveType = FriendActiveType.AddFriend;
        _curNicknameAdd   = "";

        Localization();

        uiTab.mail.value      = true;
        uiTab.subReport.value = true;

        curStatus    = Status.None;
        curSubStatus = SubStatus.None;

        uiEnemy.list  = new List <GameObject>();
        uiFriend.list = new List <GameObject>();
        uiSystem.list = new List <GameObject>();
        uiReport.list = new List <GameObject>();

        OnChangeStatus(Status.Mail);
        OnChangeSubStatus(SubStatus.Report);

        InitAvatarSet();
    }
Пример #3
0
    void Start()
    {
        // THIS MAY NEED TO COME OUT AND BE REPLACED WITH A PROPER EXIT BUTTON
        //Screen.fullScreen = false;
#if !(UNITY_IOS || UNITY_ANDROID)
        socialOpts.SetActive(false);
        exitBtn.SetActive(false);
#endif

        persistorObj = GameObject.Find("Persistor");
        audioCtrl    = persistorObj.GetComponent <AudioController>();
        adCtrl       = persistorObj.GetComponent <AdController>();
        socCtrl      = persistorObj.GetComponent <SocialController>();

        adLaunched = false;

        blinker = GetComponent <BlinkerController>();
        audioS  = GetComponent <AudioSource> ();
        AudioListener.volume = audioCtrl.CurrVolume;
        volSlider.value      = audioCtrl.CurrVolume;

        uiButtons = GetComponentsInChildren <Button>();

        Reset();
        state = TitleScreenState.none;

        angle = 0.0f;
    }
Пример #4
0
        public void Test1()
        {
            List <Topic> DD = new List <Topic> {
                new Topic {
                    topicId   = 1,
                    topicName = "Prateek",
                    posts     = null,
                    followers = null
                }
            };

            //IEnumerable<QuestionGeneration> dummy = DD.DummyMock();  // Arrange

            Mock <ITopic> MockRepository = new Mock <ITopic>(); // Removing Dependency

            MockRepository.Setup <Task <List <Topic> > >
                (d => d.FetchTopicsFromDbAsync())
            .Returns(Task.FromResult <List <Topic> >(DD));
            //MockRepository.Setup(d => d.FetchTopicsFromDbAsync()).Returns(DD);
            SocialController socialcontroller = new SocialController(MockRepository.Object); // Act
            var actual = System.Threading.Tasks.Task <List <Topic> > .Run(() => socialcontroller.GetTopics());

            var okObjectResult = actual as Task <IActionResult>;

            // List<Topic> result = okObjectResult.Result;
            Assert.NotNull(okObjectResult);

            // var actualList = okObjectResult.Value as IEnumerable<QuestionGeneration>;

            //Assert.NotNull(actualList); // Assert
            // Console.WriteLine("actualList.Count: "+actualList.Count);
            // Assert.NotEqual(okObjectResult, 1);
        }
Пример #5
0
 private IEnumerator LogOut()
 {
     SocialController.GetInstance().LogOut();
     while (SocialController.GetInstance().isStartAllowed())
     {
         yield return(new WaitForSeconds(0.25f));
     }
     Application.Quit();
 }
        public void ThrowsExceptionIfCurrentUserDoesNotHaveAccess()
        {
            var contactRepository = new LocalRepository <Contact>();
            var userRepository    = new LocalRepository <InsideUser>();
            var emailSender       = new Mock <IEmailSender>();
            var serverTime        = new ServerTime();

            var client = new Client();

            client.Name = "Kund";
            client.Id   = 8;

            var client2 = new Client();

            client2.Name = "Kund 2";
            client2.Id   = 18;


            var contact = new Contact();

            contact.LeadType = "Chat";
            contact.Id       = 14;
            contact.Date     = new DateTime(2014, 6, 13, 14, 22, 9);
            contact.Client   = client;
            contact.ClientId = 8;

            var currentUser = new InsideUser();

            currentUser.Email    = "*****@*****.**";
            currentUser.Name     = "Linus Lind";
            currentUser.Id       = "currentUserId";
            currentUser.Client   = client2;
            currentUser.ClientId = 18;

            contactRepository.Add(contact);
            userRepository.Add(currentUser);

            var controller = new SocialController(
                contactRepository,
                userRepository,
                emailSender.Object,
                serverTime);

            GenericIdentity genericIdentity = new GenericIdentity("user");

            genericIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "currentUserId"));
            controller.User = new ClaimsPrincipal(
                new GenericPrincipal(genericIdentity, null));

            var results = controller.SendContact(14, "*****@*****.**", "08 123 456", "Message\non two rows") as UnauthorizedResult;

            Assert.IsInstanceOfType(results, typeof(UnauthorizedResult));
        }
Пример #7
0
 void Awake()
 {
     if (socialController == null)
     {
         DontDestroyOnLoad(gameObject);
         socialController = this;
     }
     else if (socialController != this)
     {
         Destroy(gameObject);
     }
 }
        public void CanConstruct()
        {
            var contactRepository = new Mock <IRepository <Contact> >();
            var userRepository    = new  Mock <IRepository <InsideUser> >();
            var emailSender       = new Mock <IEmailSender>();
            var serverTime        = new Mock <IServerTime>();

            var controller = new SocialController(
                contactRepository.Object,
                userRepository.Object,
                emailSender.Object,
                serverTime.Object);
        }
    // Use this for initialization
    void Awake()
    {
        if (instance == null){
            instance = this;

            // Authenticate and register a ProcessAuthentication callback
            // This call needs to be made before we can proceed to other calls in the Social API
            Social.localUser.Authenticate (ProcessAuthentication);
        }
        else if (instance != this){
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #10
0
    void Start()
    {
        flipsRoundTxt     = flipsRoundTxtObj.GetComponent <Text>();
        scoreRoundTxt     = scoreRoundTxtObj.GetComponent <Text>();
        comboRoundHighTxt = comboRoundHighTxtObj.GetComponent <Text>();

        persistorObj = GameObject.Find("Persistor");
        socCtrl      = persistorObj.GetComponent <SocialController>();

        blinker = GetComponent <BlinkerController>();

        //uiButtons = GetComponentsInChildren<Button>();

        //PlayGamesPlatform.DebugLogEnabled = true;
        //PlayGamesPlatform.Activate();
    }
        public void ReturnsNotFoundForMissingContact()
        {
            var contactRepository = new LocalRepository <Contact>();
            var userRepository    = new LocalRepository <InsideUser>();
            var emailSender       = new Mock <IEmailSender>();
            var serverTime        = new ServerTime();

            var contact = new Contact();

            contact.LeadType = "Chat";
            contact.Id       = 14;
            contact.Date     = new DateTime(2014, 6, 13, 14, 22, 9);

            var currentUser = new InsideUser();

            currentUser.Email = "*****@*****.**";
            currentUser.Name  = "Linus Lind";
            currentUser.Id    = "currentUserId";

            contactRepository.Add(contact);
            userRepository.Add(currentUser);

            var controller = new SocialController(
                contactRepository,
                userRepository,
                emailSender.Object,
                serverTime);

            GenericIdentity genericIdentity = new GenericIdentity("user");

            genericIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "currentUserId"));
            controller.User = new ClaimsPrincipal(
                new GenericPrincipal(genericIdentity, null));

            var results = controller.SendContact(15, "*****@*****.**", "08 123 456", "Message\non two rows");

            Assert.IsInstanceOfType(results, typeof(NotFoundResult));
        }
Пример #12
0
 private static void StartAndroid()
 {
     instance = new SocialControllerAndroid();
 }
Пример #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 private void _achievementController_OnCompletedAchievement(Achievement e)
 {
     this.ScreenManager.AddScreen(new AchievementsPopup(e, _camera, _width));
     SocialController.Unlock(e);
 }
Пример #14
0
 public void ShowLeaderBoard()
 {
     SocialController.GetInstance().ShowLeaderBoard();
 }
        public void GeneratesAndSendsEmail()
        {
            var contactRepository = new LocalRepository <Contact>();
            var userRepository    = new LocalRepository <InsideUser>();
            var emailSender       = new Mock <IEmailSender>(MockBehavior.Strict);
            var serverTime        = new ServerTime();

            var client = new Client();

            client.Name = "Kund";
            client.Id   = 8;

            var contact = new Contact();

            contact.LeadType = "Chat";
            contact.Id       = 14;
            contact.Date     = new DateTime(2014, 6, 13, 14, 22, 9);
            contact.Client   = client;
            contact.ClientId = client.Id;

            var currentUser = new InsideUser();

            currentUser.Email    = "*****@*****.**";
            currentUser.Name     = "Linus Lind";
            currentUser.Id       = "currentUserId";
            currentUser.Client   = client;
            currentUser.ClientId = client.Id;

            contactRepository.Add(contact);
            userRepository.Add(currentUser);

            var controller = new SocialController(
                contactRepository,
                userRepository,
                emailSender.Object,
                serverTime);

            GenericIdentity genericIdentity = new GenericIdentity("user");

            genericIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "currentUserId"));
            controller.User = new ClaimsPrincipal(
                new GenericPrincipal(genericIdentity, null));


            Expression <Action <IEmailSender> > emailMatch = es => es.Send(
                It.Is <EmailMessage>(
                    em =>
                    em.html.Contains(
                        "Linus Lind har delat en kundkontakt från Helloy med dig"
                        ) && em.html.Contains(
                        "08 123 456 den 13 juni 2014 16:22"
                        ) && em.html.Contains(
                        "Message<br/>on two rows"
                        ) && em.to.Any(t => t.email == "*****@*****.**") &&
                    em.from_email == "*****@*****.**"

                    ));

            emailSender.Setup(emailMatch);

            var sendEmail = controller.SendContact(14, "*****@*****.**", "08 123 456", "Message\non two rows");

            emailSender.Verify(emailMatch, Times.Once);
        }
Пример #16
0
 private static void StartiOS()
 {
     instance = new SocialController();
 }
Пример #17
0
 // Use this for initialization
 void Start()
 {
     socialController = SocialController.GetInstance();
     panelGooglePlay.Show();
 }