Esempio n. 1
0
    void Awake()
    {
        if (!mInstance)
        {
            mInstance = this;
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(this);

        if (RESET_ALL_DATA)
        {
            PlayerPrefs.DeleteAll();
        }

#if UNITY_EDITOR
        path = Application.persistentDataPath + "/";
#else
        path = Application.persistentDataPath + "/";
#endif

        serverConnect      = GetComponent <ServerConnect>();
        avatarImages       = GetComponent <AvatarImages>();
        hiscoresByMissions = GetComponent <HiscoresByMissions>();

        LoadUser();

        hiscoresByMissions.Init();
    }
        static void ClosePlasticWindow(PlasticWindow window)
        {
            UnRegisterApplicationFocusHandlers(window);

            DisposeNewIncomingChanges(window);

            AvatarImages.Dispose();
        }
Esempio n. 3
0
 public void createImagesDirectory(AvatarImages avatarImage)
 {
     try
     {
         string sizeDirectory = WORKING_DIRECTORY + Path.DirectorySeparatorChar + USERS_PATH + Path.DirectorySeparatorChar + userId + Path.DirectorySeparatorChar + AVATAR_PATH + Path.DirectorySeparatorChar + avatarImage.size;
         Directory.CreateDirectory(sizeDirectory);
         File.WriteAllBytes(sizeDirectory + Path.DirectorySeparatorChar + avatarImage.name, Convert.FromBase64String(avatarImage.data));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 4
0
        public List <AvatarImages> getAvatarByUser(string id, string fileSize)
        {
            List <AvatarImages> oAvatarList = new List <AvatarImages>();

            try
            {
                this.userId = id;
                string avatarDirectory = WORKING_DIRECTORY + Path.DirectorySeparatorChar + USERS_PATH + Path.DirectorySeparatorChar + userId + Path.DirectorySeparatorChar + AVATAR_PATH;

                if (Directory.Exists(avatarDirectory))
                {
                    string[] subdirectoryEntries = Directory.GetDirectories(avatarDirectory);
                    foreach (string subdirectory in subdirectoryEntries)
                    {
                        AvatarImages oAvatar = new AvatarImages();
                        oAvatar.size = new DirectoryInfo(subdirectory).Name;
                        if (fileSize != null && (fileSize == LG || fileSize == MD || fileSize == SM || fileSize == XS))
                        {
                            if (fileSize != oAvatar.size)
                            {
                                continue;
                            }
                        }

                        string[] fileEntries = Directory.GetFiles(subdirectory);
                        foreach (string fileName in fileEntries)
                        {
                            oAvatar.name = Path.GetFileName(fileName);
                            //oAvatar.size = new FileInfo(fileName).Length.ToString();
                            oAvatar.type = MimeMapping.GetMimeMapping(fileName);
                            oAvatar.data = Convert.ToBase64String(File.ReadAllBytes(fileName));

                            oAvatarList.Add(oAvatar);
                        }
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(oAvatarList);
        }
Esempio n. 5
0
        static void ClosePlasticWindow(PlasticWindow window)
        {
            UnRegisterApplicationFocusHandlers(window);

            PlasticApp.Dispose();

            DrawInspectorOperations.Disable();

            DrawAssetOverlay.Dispose();

            if (window.mEventSenderScheduler != null)
            {
                window.mPingEventLoop.Stop();
                window.mEventSenderScheduler.End();
            }

            DisposeNewIncomingChanges(window);

            AvatarImages.Dispose();
        }
Esempio n. 6
0
    void Awake()
    {
        if (!mInstance)
        {
            mInstance = this;
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(this);

#if UNITY_EDITOR
        path = Application.persistentDataPath + "/";
#else
        path = Application.persistentDataPath + "/";
#endif

        serverConnect      = GetComponent <ServerConnect>();
        avatarImages       = GetComponent <AvatarImages>();
        hiscoresByMissions = GetComponent <HiscoresByMissions>();
    }