示例#1
0
        private void ParseData(JSONObject item)
        {
            var settings  = this.socialModule.GetSettings <FBSettings>();
            var mainPhoto = settings.profileMainPhoto;

            var picture = item.GetField("picture");

            if (picture.isContainer == true)
            {
                picture = picture.GetField("data");
                if (picture.isContainer == true)
                {
                    var url = picture.GetField("url").str;
                    this.photoIsDefault = picture.GetField("is_silhouette").b;
                    SocialSystem.LoadImage(mainPhoto == "photo_50", this.photo_50 = url, (texture, result) => this.photo_50_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
                }
            }

            var items = item.GetField("devices");

            if (items != null && items.IsArray == true)
            {
                this.devices = new List <UserDevice>();
                foreach (var device in items.list)
                {
                    this.devices.Add(new UserDevice(device));
                }
            }

            this.SetSex(item.GetField("gender").str);
            this.SetUserID(item.GetField("id").str);
            this.SetUserName(item.GetField("name").str);

            this.bdate = item.GetField("birthday").str;

            this.about               = item.GetField("about").str;
            this.bio                 = item.GetField("bio").str;
            this.installed           = item.GetField("installed").b;
            this.is_verified         = item.GetField("is_verified").b;
            this.link                = item.GetField("link").str;
            this.locale              = item.GetField("locale").str;
            this.political           = item.GetField("political").str;
            this.relationship_status = item.GetField("relationship_status").str;
            this.religion            = item.GetField("religion").str;
            this.quotes              = item.GetField("quotes").str;
            this.third_party_id      = item.GetField("third_party_id").str;
            this.timezone            = item.GetField("timezone").f;
            this.token_for_business  = item.GetField("token_for_business").str;
            this.verified            = item.GetField("verified").b;
            this.website             = item.GetField("website").str;

            this.SetAuthenticated(true);
            this.SetState(UnityEngine.SocialPlatforms.UserState.Online);
        }
        public override void Enter()
        {
            base.Enter();

            SocialSystem socialSystem = Controlled.CivilManager.GetSystem <SocialSystem>();

            if (socialSystem.DieRecords.CreateRecord(Controlled) == null)
            {
                throw new Exception("The human is already died");
            }
        }
示例#3
0
    public const string _albumArtRoot      = "AlbumArts"; // 앨범아트 스프라이트 경로


    public static void InitCommonSystems()
    {
        if (GlobalSystem._Instance == null)
        {
            GlobalSystem.CreateInstance();
        }

        if (SocialSystem._Instance == null)
        {
            SocialSystem.CreateInstance();
        }
    }
示例#4
0
 public static SocialSystem CreateInstance()
 {
     if (_Instance != null)
     {
         Debug.LogError("[SocialSystem] Instance was already created");
         return(null);
     }
     else
     {
         _Instance = new SocialSystem();
         return(_Instance);
     }
 }
        public override bool CheckTransition()
        {
            bool     pass        = false;
            TimeSpan elapsedTiem = GameTimeSettings.CurrentGameTime - _timeOfLastSeek;

            if (elapsedTiem.TotalDays >= 1)
            {
                SocialSystem socialSystem = Controlled.CivilManager.GetSystem <SocialSystem>();

                bool isMarried = socialSystem.MarriageRecords.GetRecord(Controlled) != null;
                pass            = (Controlled.Age.TotalDays > 16) && (!isMarried);
                _timeOfLastSeek = GameTimeSettings.CurrentGameTime;
            }

            return(pass);
        }
        public override void Enter()
        {
            SocialSystem socialSystem = Controlled.CivilManager.GetSystem <SocialSystem>();

            var   suitableWomen = socialSystem.GetSuitableWomenForMarriage((Man)Controlled);
            bool  accepted      = false;
            Woman selectedWife  = null;

            while (!accepted && suitableWomen.Count > 0)
            {
                selectedWife = RandomSelector.SelectRandomSample(suitableWomen);
                suitableWomen.Remove(selectedWife);
                accepted = selectedWife.ResponseForMarriageProposal((Man)Controlled);
            }

            base.Enter();
        }
示例#7
0
        public SocialHttp(string url, System.Action <Texture, bool> onCompleted)
        {
            this.www = new WWW(url);

            SocialSystem.WaitFor(this.Wait(() => {
                if (string.IsNullOrEmpty(this.www.error) == false)
                {
                    Debug.LogError(this.www.error);

                    // error
                    onCompleted(null, false);
                }
                else
                {
                    // success
                    onCompleted(this.www.texture, true);
                }
            }));
        }
示例#8
0
        private void ParseData(JSONObject item)
        {
            this.SetSex((int)item.GetField("sex").n);
            this.SetUserID(item.GetField("uid").d.ToString());
            this.SetUserName(string.Format("{0} {1}", item.GetField("first_name").str, item.GetField("last_name").str));

            this.onlineState = (int)item.GetField("online").n;

            this.SetAuthenticated(true);
            this.SetState(UnityEngine.SocialPlatforms.UserState.Online);

            var settings  = this.socialModule.GetSettings <VKSettings>();
            var mainPhoto = settings.profileMainPhoto;

            SocialSystem.LoadImage(mainPhoto == "photo_50", this.photo_50             = item.GetField("photo_50").str, (texture, result) => this.photo_50_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
            SocialSystem.LoadImage(mainPhoto == "photo_100", this.photo_100           = item.GetField("photo_100").str, (texture, result) => this.photo_100_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
            SocialSystem.LoadImage(mainPhoto == "photo_200_orig", this.photo_200_orig = item.GetField("photo_200_orig").str, (texture, result) => this.photo_200_orig_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
            SocialSystem.LoadImage(mainPhoto == "photo_200", this.photo_200           = item.GetField("photo_200").str, (texture, result) => this.photo_200_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
            SocialSystem.LoadImage(mainPhoto == "photo_400_orig", this.photo_400_orig = item.GetField("photo_400_orig").str, (texture, result) => this.photo_400_orig_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
            SocialSystem.LoadImage(mainPhoto == "photo_max", this.photo_max           = item.GetField("photo_max").str, (texture, result) => this.photo_max_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
            SocialSystem.LoadImage(mainPhoto == "photo_max_orig", this.photo_max_orig = item.GetField("photo_max_orig").str, (texture, result) => this.photo_max_orig_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
        }
示例#9
0
        public SocialHttp(string url, System.Action <Texture, bool> onCompleted)
        {
            this.www = new WWW(url);

            SocialSystem.WaitFor(this.Wait(() => {
                if (string.IsNullOrEmpty(this.www.error) == false)
                {
                    if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                    {
                        UnityEngine.Debug.LogError(this.www.error);
                    }

                    // error
                    onCompleted(null, false);
                }
                else
                {
                    // success
                    onCompleted(this.www.texture, true);
                }
            }));
        }
示例#10
0
    private void Awake()
    {
        //Check if there is already an instance
        if (instance == null)
        {
            //if not, set it to this.
            instance = this;
        }
        //If instance already exists:
        else if (instance != this)
        {
            //Destroy this, this enforces our singleton pattern so there can only be one instance
            Destroy(gameObject);
        }
#if UNITY_IPHONE
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif

#if UNITY_ANDROID
        //PlayGamesPlatform.Activate();
#endif
        //if(Application.platform == RuntimePlatform.Android){
        //}
    }
示例#11
0
        public SocialHttp(ModuleSettings settings, string url, HTTPParams parameters, HTTPType httpType, System.Action <string, bool> onCompleted)
        {
                        #if USE_WWW
            if (httpType == HTTPType.Post)
            {
                var form = new WWWForm();
                foreach (var param in parameters.items)
                {
                    form.AddField(param.key, param.GetValue(settings));
                }

                this.www = new WWW(url, form);
            }
            else if (httpType == HTTPType.Get)
            {
                foreach (var param in parameters.items)
                {
                    url = url.Replace("{" + param.key + "}", param.GetValue(settings));
                }

                this.www = new WWW(url);
            }

            SocialSystem.WaitFor(this.Wait(() => {
                if (string.IsNullOrEmpty(this.www.error) == false)
                {
                    Debug.LogError(this.www.error);

                    // error
                    onCompleted(this.www.error, false);
                }
                else
                {
                    // success
                    onCompleted(this.www.text, true);
                }
            }));
                        #else
            if (httpType == HTTPType.Post)
            {
                var form = new WWWForm();
                foreach (var param in parameters.items)
                {
                    form.AddField(param.key, param.GetValue(settings));
                }

                this.www = new WWW(url, form);
            }
            else if (httpType == HTTPType.Get)
            {
                foreach (var param in parameters.items)
                {
                    url = url.Replace("{" + param.key + "}", param.GetValue(settings));
                }

                ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return(true); });

                var uri = new Uri(url.Trim() + "/");                    // I don't know about last `/` but it works only with it ;(

                WebRequest request = WebRequest.Create(uri);
                // If required by the server, set the credentials.
                request.Credentials = CredentialCache.DefaultCredentials;
                // Get the response.
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                // Get the stream containing content returned by the server.
                Stream dataStream = response.GetResponseStream();
                // Open the stream using a StreamReader for easy access.
                StreamReader reader = new StreamReader(dataStream);
                // Read the content.
                string responseFromServer = reader.ReadToEnd();

                // Cleanup the streams and the response.
                reader.Close();
                dataStream.Close();
                response.Close();

                onCompleted(responseFromServer, response.StatusCode == HttpStatusCode.OK);
            }
                        #endif

            Debug.Log(url);
        }