Exemple #1
0
        public SQLiteTester()
        {
            //SQLiteClient.CreateDB(TestFilename);
            dbClient = new SQLiteClient();
            dbClient.Open(TestFilename);

            if (!dbClient.ExistTable("Member"))
            {
                GDebug.Log(dbClient.CreateTable("Member",
                                                new SQLiteFieldAffinity(TypeAffinity.Text, "ID"),
                                                new SQLiteFieldAffinity(TypeAffinity.Text, "PW")));
            }

            var resultDataSet = dbClient.ExecuteDataset("SELECT * FROM Member WHERE PW LIKE '%345%'");

            GDebug.Log("Result " + resultDataSet.Tables[0].Rows[1][0]);
            object result = dbClient.ExecuteScalar("SELECT PW FROM Member WHERE ID='isg1153'");

            if (result != null)
            {
                string foundPw = result as string;
                GDebug.Log(foundPw);
            }
            else
            {
                GDebug.Log(dbClient.InsertRow("Member",
                                              new SQLiteField("ID", DbType.String, "isg1153"),
                                              new SQLiteField("PW", DbType.String, "123456")));
            }

            dbClient.Close();
        }
Exemple #2
0
        public override void Initialization()
        {
            base.Initialization();
            GDebug.Log("GAME START INITIALIZE", this, LogCategory.STATE_CONTROLLERS);

            _soundManager.PlayMusic(SoundDataConfig.INTRO_MUSIC);
        }
Exemple #3
0
        public static void Set(string KeyName, bool enable, string arg = null)
        {
            try {
                RegistryKey startupKey = Registry.CurrentUser.OpenSubKey(runKey, true);

                if (enable)
                {
                    Set(KeyName, false);
                    string value = "\"" + IOUtility.AppFileInfo.FullName.Replace('/', '\\') + "\" ";
                    if (!string.IsNullOrEmpty(arg))
                    {
                        value += arg;
                    }
                    startupKey.SetValue(KeyName, value);
                    startupKey.Close();
                }
                else
                {
                    startupKey.DeleteValue(KeyName, false);
                    startupKey.Close();
                }
            } catch (Exception ex) {
                GDebug.Log(ex.ToString(), GLogLevel.Warnning);
            }
        }
Exemple #4
0
        public override void Handle()
        {
            GDebug.Log("Big SphericalTribune Start", this, LogCategory.STATE_MACHINE);

            _controller = _factory.Create();
            _controller.Initialization();
        }
Exemple #5
0
        private void OnAddFriendsSuccess(string in_stringData, object in_obj)
        {
            GStateManager.Instance.EnableLoadingSpinner(false);
            GDebug.Log(string.Format("Success | {0}", in_stringData));

            GFriendsManager.Instance.GetPresenceOfFriends();
        }
Exemple #6
0
        public override void Handle()
        {
            GDebug.Log("GamestartState Start", this, LogCategory.STATE_MACHINE);

            _controller = _factory.Create();
            _controller.Initialization();
        }
Exemple #7
0
        public override void Initialization()
        {
            base.Initialization();
            GDebug.Log("GAME OVER INITIALIZE", this, LogCategory.STATE_CONTROLLERS);

            _soundManager.PlaySFX(SoundDataConfig.GAMEOVER);
        }
Exemple #8
0
        public static void DownloadFile(string url, DirectoryInfo directoryInfo)
        {
            byte[] data = DownloadData(url);

            //GetPath
            Uri    uri = new Uri(url);
            string localPath;

            if (url.Length > 6 && url.Substring(url.Length - 6) == ":large")
            {
                //Twitter
                localPath = new Uri(url.Substring(0, url.Length - 6)).LocalPath;
            }
            else
            {
                localPath = uri.LocalPath;
            }
            string filePath  = Path.Combine(directoryInfo.FullName, Path.GetFileName(localPath));
            string fileName  = Path.GetFileNameWithoutExtension(filePath);
            string extension = Path.GetExtension(filePath);

            //Find Extension
            if (string.IsNullOrEmpty(extension))
            {
                try {
                    using (MemoryStream stream = new MemoryStream(data)) {
                        ImageFileFormat format = IOUtility.GetImageFormat(stream);

                        if (format != ImageFileFormat.unknown)
                        {
                            extension = "." + format.ToString();
                            filePath += extension;
                        }
                        else
                        {
                            extension = "";
                        }
                    }
                } catch (Exception ex) {
                    GDebug.Log(ex.ToString(), GLogLevel.Warnning);
                    extension = "";
                }
            }

            int num = 2;

            while (File.Exists(filePath))
            {
                filePath = Path.Combine(directoryInfo.FullName, fileName + num + extension);
                ++num;
            }

            using (FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite)) {
                fileStream.Write(data, 0, data.Length);
            }
        }
Exemple #9
0
        private void Play(AudioClip clip, float volume, bool loop = false)
        {
            GDebug.Log("playing sound fx:" + clip.name, this, LogCategory.SOUND_MANAGER);
            AudioSource source = GetSourceFromPool();

            source.volume = volume;
            source.clip   = clip;
            source.Play();
            source.loop = loop;
        }
Exemple #10
0
 /// <summary>
 /// 함수를 호출하며 예외를 검사합니다.
 /// </summary>
 public static bool TryInvoke(this Action action)
 {
     try {
         action?.Invoke();
         return(true);
     } catch (Exception ex) {
         GDebug.Log(ex.ToString(), GLogLevel.Warnning);
         return(false);
     }
 }
Exemple #11
0
        public void FadeOutMusic(AudioSource musicSource, float targetVolume)
        {
            if (musicSource == null || musicSource.clip == null)
            {
                return;
            }
            GDebug.Log("fading out music: " + musicSource.clip.name, this, LogCategory.SOUND_MANAGER);

            _musicFadeOutTweener = DOTween.To(() => musicSource.volume, (val) => musicSource.volume = val, targetVolume, FadeTime).OnComplete(() => this.DoneMusicFade(musicSource));
        }
Exemple #12
0
        public void FadeOutMusic(AudioSource musicSource)
        {
            if (musicSource == null || musicSource.clip == null)
            {
                return;
            }
            GDebug.Log("fading out music: " + musicSource.clip.name, this, LogCategory.SOUND_MANAGER);

            _musicFadeOutTweener = DOTween.To(() => musicSource.volume, (val) => musicSource.volume = val, 0f, FadeTime).OnComplete(() => this.DoneMusicFade(musicSource));
            //        _musicFadeOutTweener = HOTween.To(musicSource, FadeTime, new TweenParms().Prop("volume", 0f)._onComplete(this.doneMusicFade, musicSource));
        }
Exemple #13
0
        public static bool Get(string KeyName)
        {
            try {
                RegistryKey startupKey = Registry.CurrentUser.OpenSubKey(runKey, true);

                return(startupKey.GetValue(KeyName) != null);
            } catch (Exception ex) {
                GDebug.Log(ex.ToString(), GLogLevel.Warnning);
            }
            return(false);
        }
Exemple #14
0
    private void OnDestroyPoint(GraphPoint point)
    {
        graphPoints.Remove(point);

        for (int i = 0; i < MAX_POINTS_COUNT; i++)
        {
            sizeMatrix[i, point.Id] = INF;
            sizeMatrix[point.Id, i] = INF;
        }
        FindAndDeleteEdge(point);
        GDebug.Log("Точка " + point.Id + " удалена");
    }
Exemple #15
0
        public override void Initialization()
        {
            base.Initialization();
            GDebug.Log("GAME PLAY INITIALIZE", this, LogCategory.STATE_CONTROLLERS);

            ResetGameplayState();
            Subscriptions();

            SpawnUser();
            SpawnEnemies();

            _soundManager.PlayMusic(SoundDataConfig.GAME_MUSIC);
        }
Exemple #16
0
        private AudioSource GetSourceFromPool()
        {
            foreach (AudioSource adSource in AudioSourcePool)
            {
                if (adSource != null && !adSource.isPlaying)
                {
                    return(adSource);
                }
            }

            GDebug.Log("Audio Source Pool passed limit of " + AudioPoolSize + ", stealing sound from first source", this, LogCategory.SOUND_MANAGER);
            return(AudioSourcePool[0]);
        }
Exemple #17
0
        public void Initialize()
        {
            GDebug.Log("Application start", this, LogCategory.GAME_MANAGER);

            _gamePresenter = _gamePresenterFactory.Create();
            _gamePresenter.transform.position   = Vector3.zero;
            _gamePresenter.transform.localScale = Vector3.one;

            _disposables = new CompositeDisposable();

            Subscriptions();

            _onGamestartSignal.Fire();
        }
        private static void OnAttachFacebookIdentityFail(int status, int reasonCode, string jsonError, object cbObject)
        {
            //Handle Fail
            GDebug.Log("attach failed " + reasonCode + " " + jsonError);
            switch (reasonCode)
            {
            case ReasonCodes.DUPLICATE_IDENTITY_TYPE:
                // Account already attached
                break;

            case ReasonCodes.MERGE_PROFILES:
                ConnectFBAccount();
                break;
            }
        }
Exemple #19
0
    /// <summary>
    /// Удалить ребро между выбранными вершинами
    /// </summary>
    public void DeleteEdge()
    {
        if (CheckSelection())
        {
            GraphPoint pointA      = selectedPoints[0];
            GraphPoint pointB      = selectedPoints[1];
            bool       isConnected = sizeMatrix[pointA.Id, pointB.Id] != INF;

            GDebug.Log(string.Format("удаление ребра {0}, {1}...", pointA.Id, pointB.Id));

            if (isConnected)
            {
                Disсonnect(pointA, pointB);
            }
        }
    }
Exemple #20
0
    /// <summary>
    /// Соединить две выбранные вершины
    /// </summary>
    public void DrawEdge()
    {
        if (CheckSelection())
        {
            GraphPoint pointA = selectedPoints[0];
            GraphPoint pointB = selectedPoints[1];
            int        A      = pointA.Id;
            int        B      = pointB.Id;

            if (sizeMatrix[A, B] == INF)
            {
                Connect(pointA, pointB);
                GDebug.Log(string.Format("соединены {0}, {1}", pointA.Id, pointB.Id));
            }
        }
    }
Exemple #21
0
 public static bool Start(string path, string args = null)
 {
     try {
         Process process = new Process();
         process.StartInfo.FileName = path;
         if (!string.IsNullOrEmpty(args))
         {
             process.StartInfo.Arguments = args;
         }
         process.Start();
         return(true);
     } catch (Exception ex) {
         GDebug.Log(ex.ToString(), GLogLevel.Warnning);
         return(false);
     }
 }
Exemple #22
0
        public void PlaySFX(AudioClip soundClip, float volume, InterruptionType interruptType, List <string> alsoInterrupt, bool loop = false)
        {
            GDebug.Log("try play " + soundClip.name + " with volume " + volume + " interrupt " + interruptType, this, LogCategory.SOUND_MANAGER);

            if (!MuteAllSound && !MuteSfx)
            {
                switch (interruptType)
                {
                case InterruptionType.DontCare:
                    Play(soundClip, volume, loop);
                    break;

                case InterruptionType.DontInterrupt:
                    if (!SFXIsPlaying(soundClip))
                    {
                        Play(soundClip, volume, loop);
                    }
                    break;

                case InterruptionType.Interrupt:
                    if (SFXIsPlaying(soundClip))
                    {
                        GetPlayingSFXSource(soundClip).Stop();
                        StopPlayingSoundList(alsoInterrupt, soundClip.name);
                        Play(soundClip, volume, loop);
                    }
                    else
                    {
                        if (soundClip != null)
                        {
                            StopPlayingSoundList(alsoInterrupt, soundClip.name);
                        }
                        Play(soundClip, volume, loop);
                    }
                    break;

                case InterruptionType.DontInterruptButInterruptOthers:
                    if (!SFXIsPlaying(soundClip))
                    {
                        Play(soundClip, volume, loop);
                    }
                    StopPlayingSoundList(alsoInterrupt, soundClip.name);
                    break;
                }
            }
        }
Exemple #23
0
 public static GameObject FindGameObject(this Transform transform, string name)
 {
     try {
         int count = transform.childCount;
         for (int i = 0; i < count; ++i)
         {
             Transform child = transform.GetChild(i);
             if (child.name == name)
             {
                 return(child.gameObject);
             }
         }
     } catch (Exception ex) {
         GDebug.Log($"Can't find gameObject'{name}'{Environment.NewLine}{ex.ToString()}", GLogLevel.Warnning);
     }
     return(null);
 }
Exemple #24
0
        public void ChangeState(GameStateType gameState)
        {
            if (null != _currentStateObject)
            {
                _currentStateObject.Dispose();
                _currentStateObject = null;
            }

            _previousState     = _currentState;
            _currentState      = gameState;
            CurrentState.Value = _currentState;

            _currentStateObject = _gameStateFactory.Create(gameState);
            _currentStateObject.Handle();

            GDebug.Log("Change state to " + gameState, this, LogCategory.STATE_MACHINE);
        }
Exemple #25
0
        public void DoneMusicFade(AudioSource fadedTargetAudioSource)
        {
            if (fadedTargetAudioSource == null || fadedTargetAudioSource.clip == null)
            {
                return;
            }

            if (fadedTargetAudioSource.volume < .1f)
            {
                GDebug.Log("done music fade stoping music: " + fadedTargetAudioSource.clip.name, this, LogCategory.SOUND_MANAGER);
                fadedTargetAudioSource.Pause();
            }
            else
            {
                GDebug.Log("music Fade is done, but volume is above .1(" + fadedTargetAudioSource.volume + "} so wasnt killed.", this, LogCategory.SOUND_MANAGER);
            }
        }
Exemple #26
0
        internal bool Run(float deltaMillisec)
        {
            try {
                if (UpdateTime(deltaMillisec))
                {
                    return(true);
                }
                if (delayMillisec <= 0f)
                {
                    bool hasValue = routine.MoveNext();
                    if (hasValue)
                    {
                        object returnObject = routine.Current;
                        GWait  waitOrder    = CastWaitOrder(returnObject);
                        if (waitOrder != null)
                        {
                            switch (waitOrder.unit)
                            {
                            case GTimeUnit.Frame:
                                delayFrame += (int)waitOrder.time;
                                break;

                            case GTimeUnit.Millisecond:
                                delayMillisec += waitOrder.time;
                                break;

                            case GTimeUnit.Second:
                                delayMillisec += waitOrder.time * 1000f;
                                break;
                            }
                        }
                    }
                    else
                    {
                        Complete();
                    }
                    return(hasValue);
                }
                return(true);
            } catch (Exception ex) {
                GDebug.Log(ex.ToString(), GLogLevel.Error);
                Complete();
                return(false);
            }
        }
Exemple #27
0
        private void DoMusicPlay(AudioClip musicClip, float startVolume, float endVolume)
        {
            GDebug.Log("playing music: " + musicClip.name, this, LogCategory.SOUND_MANAGER);

            if (CurrentMusicAudioSource != null)
            {
                CurrentMusicAudioSource.clip   = musicClip;
                CurrentMusicAudioSource.volume = startVolume;

                if (!_muteMusic)
                {
                    CurrentMusicAudioSource.Play();
                }

                DOTween.Kill(_musicFadeOutTweener);

                _musicFadeInTweener = DOTween.To(() => CurrentMusicAudioSource.volume, (val) => CurrentMusicAudioSource.volume = val, endVolume, FadeTime).SetEase(Ease.InCubic);
            }
        }
Exemple #28
0
        public virtual void PlayMusic(string musicClipName, float volume)
        {
            MusicVolume = volume;
            if (!MuteAllSound)
            {
                AudioClip musicClip = MusicPlaylist.FindByName(musicClipName);

                if (musicClip == null)
                {
                    GDebug.LogError("NO SOUNDTRACK " + musicClipName, this, LogCategory.SOUND_MANAGER);
                    GDebug.Log("Tried to play music : " + musicClipName + " but soundManager could not find it!", this, LogCategory.SOUND_MANAGER);
                    return;
                }

                //we have music playing already
                GDebug.Log("playing: " + musicClip.name, this, LogCategory.SOUND_MANAGER);
                DoMusicPlay(musicClip, volume);
            }
        }
Exemple #29
0
        public static BitmapSource OpenImageFile()
        {
            BitmapSource   image;
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "이미지 파일 (*.png;*.jpg;*.jpeg;*.gif;*.tiff;*.bmp)|*.png;*.jpg;*.gif;*.tiff;*.bmp|All files (*.*)|*.*";
            dialog.Title  = "이미지 파일을 선택하세요.";
            try {
                bool?result = dialog.ShowDialog();
                if (result.HasValue && result.Value)
                {
                    image = dialog.FileName.GetBitmap();

                    return(image);
                }
            } catch (Exception ex) {
                GDebug.Log("Failed to load image. " + ex.ToString());
            }
            return(null);
        }
Exemple #30
0
        private static async void MainLoop()
        {
            for (; ;)
            {
                await MainWaitOne();

                int count = mainJobQueue.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        try {
                            mainJobQueue.Dequeue()();
                        } catch (Exception ex) {
                            GDebug.Log($"{nameof(ThreadChannel)} ::{Environment.NewLine}{ex.ToString()}", GLogLevel.Warnning);
                        }
                    }
                }
            }
        }