コード例 #1
0
        public override void Handle()
        {
            GDebug.Log("Big SphericalTribune Start", this, LogCategory.STATE_MACHINE);

            _controller = _factory.Create();
            _controller.Initialization();
        }
コード例 #2
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();
        }
コード例 #3
0
ファイル: WintabInput.cs プロジェクト: Bgoon/GKit
        private void OnReceivePacket(object sender, MessageReceivedEventArgs e)
        {
            //6~7ms rate
            if (data == null || !IsRunning)
            {
                return;
            }
            try {
                uint pktID = (uint)e.Message.WParam;
                packet = data.GetDataPacket(pktID);
                if (packet.pkContext.IsValid)
                {
                    lock (dataWriteLock) {
                        MarkActive();

                        pressure = (float)packet.pkNormalPressure / maxNormalPressure;
                        distance = (float)packet.pkZ / maxTangentPressure;
                        position = new Vector2(packet.pkX, packet.pkY) / OutputExtFactor;

                        position.y = systemRect.yMax - position.y + systemRect.yMin;
                    }
                }
            } catch (Exception ex) {
                GDebug.Log(ex.ToString(), GLogLevel.Warnning);
            }
        }
コード例 #4
0
        public static void MoveAllFiles(DirectoryInfo originInfo, DirectoryInfo destInfo)
        {
            try {
                destInfo.Create();

                foreach (FileInfo fileInfo in originInfo.GetFiles())
                {
                    try {
                        string newFilePath = Path.Combine(destInfo.FullName, fileInfo.Name);
                        if (File.Exists(newFilePath))
                        {
                            File.Delete(newFilePath);
                        }
                        fileInfo.MoveTo(newFilePath);
                    } catch (Exception ex) {
                        GDebug.Log(ex.ToString());
                    }
                }
                foreach (DirectoryInfo subDirectory in originInfo.GetDirectories())
                {
                    DirectoryInfo nextDestDir = destInfo.CreateSubdirectory(subDirectory.Name);
                    MoveAllFiles(subDirectory, nextDestDir);
                }
            } catch (Exception ex) {
                GDebug.Log(ex.ToString());
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
0
        public EnemyTank InjectEnemy(EnemyType type)
        {
            EnemyTank nEnemy = null;

            switch (type)
            {
            case EnemyType.TankGreen:
                nEnemy = _tankGreenFactory.Create();
                break;

            case EnemyType.TankEllo:
                nEnemy = _tankElloFactory.Create();
                break;

            case EnemyType.TankBlue:
                nEnemy = _tankBlueFactory.Create();
                break;

            case EnemyType.TankPurple:
                nEnemy = _tankPurpleFactory.Create();
                break;

            case EnemyType.TankRed:
                nEnemy = _tankRedFactory.Create();
                break;

            default:
                GDebug.LogError("Current Enemy type not found :" + type, this, LogCategory.ENEMY_FABRIC);
                break;
            }

            return(nEnemy);
        }
コード例 #7
0
        public override void Handle()
        {
            GDebug.Log("GameplayState Start", this, LogCategory.STATE_MACHINE);

            _controller = _factory.Create();
            _controller.Initialization();
        }
コード例 #8
0
        public override void Initialization()
        {
            base.Initialization();
            GDebug.Log("GAME OVER INITIALIZE", this, LogCategory.STATE_CONTROLLERS);

            _soundManager.PlaySFX(SoundDataConfig.GAMEOVER);
        }
コード例 #9
0
        private void OnUpdateUserNameSuccess(string in_stringData, object in_obj)
        {
            GStateManager.Instance.EnableLoadingSpinner(false);
            GDebug.Log(string.Format("Success | {0}", in_stringData));

            Dictionary <string, object> jsonMessage  = (Dictionary <string, object>)JsonReader.Deserialize(in_stringData);
            Dictionary <string, object> jsonData     = (Dictionary <string, object>)jsonMessage[BrainCloudConsts.JSON_DATA];
            Dictionary <string, object> jsonResponse = (Dictionary <string, object>)jsonData[BrainCloudConsts.JSON_RESPONSE];

            if ((int)jsonResponse["status"] == 200)
            {
                if (jsonResponse.ContainsKey("reason_code") && (int)jsonResponse["reason_code"] == ReasonCodes.NAME_CONTAINS_PROFANITY)
                {
                    OnUpdateUserNameError((int)jsonResponse["status"], (int)jsonResponse["reason_code"], "", null);
                }
                else
                {
                    GPlayerMgr.Instance.PlayerData.PlayerName = m_inputField.text;
                }
            }
            else if ((int)jsonResponse["status"] == 400 || (int)jsonResponse["status"] == 500)
            {
                OnUpdateUserNameError((int)jsonResponse["status"], (int)jsonResponse["reason_code"], (string)jsonResponse["status_message"], null);
            }
        }
コード例 #10
0
        public override void Initialization()
        {
            base.Initialization();
            GDebug.Log("GAME START INITIALIZE", this, LogCategory.STATE_CONTROLLERS);

            _soundManager.PlayMusic(SoundDataConfig.INTRO_MUSIC);
        }
コード例 #11
0
 void NewStringFormatFastString()
 {
     for (int i = 0; i < Times; i++)
     {
         GDebug.Log(DebugFlag.Common, FastString.Format("{0} {1} {2}", 123, 456, 789));
     }
 }
コード例 #12
0
ファイル: GRoutine.cs プロジェクト: Bgoon/GKit
        private GWait CastWaitOrder(object returnObject)
        {
            GWait waitOrder = null;

            if (returnObject == null)
            {
                waitOrder = new GWait(GTimeUnit.Frame, 1);
            }
            else
            {
                if (returnObject is GWait)
                {
                    waitOrder = (GWait)returnObject;
                }
                else if (returnObject is IEnumerator)
                {
                    IEnumerator coroutine     = (IEnumerator)returnObject;
                    GRoutine    targetRoutine = ownerCore.AddGRoutine(coroutine);
                    delayRoutine = targetRoutine;
                }
                else if (routine.Current is GRoutine)
                {
                    GRoutine targetRoutine = (GRoutine)returnObject;
                    delayRoutine = targetRoutine;
                }
                else
                {
                    GDebug.Log("지원되지 않는 반환 형식입니다. 'GWait', 'GRoutine', 'IEnumerator' 클래스를 반환하세요.", GLogLevel.Error);
                    waitOrder = new GWait(GTimeUnit.Frame, 1);
                }
            }
            return(waitOrder);
        }
コード例 #13
0
ファイル: Web.cs プロジェクト: AcrylicShrimp/GKit
        public static void SaveUnknownFile(byte[] data, DirectoryInfo directoryInfo)
        {
            string fileName  = "Unknown_" + Encrypt.SimplexHash.ComputeMD5(data.Length.ToString());
            string filePath  = Path.Combine(directoryInfo.FullName, fileName);
            string extension = "";

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

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

            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);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: AcrylicShrimp/GKit
        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();
        }
コード例 #15
0
 void NewStringFormat()
 {
     for (int i = 0; i < Times; i++)
     {
         GDebug.Log(DebugFlag.Common, $"{123} {456} {789}");
     }
 }
コード例 #16
0
        public void InitFire(BaseTank tank, Weapon weapon, LayerTags frendlyLayer)
        {
            if (null == weapon)
            {
                GDebug.LogWarning("Weapon parameters is null", this, LogCategory.FIRE_CONTROLLER);
                return;
            }

            var dl1 = 0f;
            var dl2 = 0f;

            for (int i = 0; i < weapon.MaxBulletInShot; i++)
            {
                _delayService.DelayedCall(dl1, () =>
                {
                    foreach (var point in weapon.GamePointsPool)
                    {
                        if (weapon.InMomentShot)
                        {
                            AddBullet(point, weapon, frendlyLayer);
                        }
                        else
                        {
                            _delayService.DelayedCall(dl2, () => { AddBullet(point, weapon, frendlyLayer); });
                            dl2 += 0.1f;
                        }
                    }
                });

                dl1 += 0.1f;
            }
        }
コード例 #17
0
ファイル: Web.cs プロジェクト: AcrylicShrimp/GKit
        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);
            }
        }
コード例 #18
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);
     }
 }
コード例 #19
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));
        }
コード例 #20
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;
        }
コード例 #21
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));
        }
コード例 #22
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);
        }
コード例 #23
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 + " удалена");
    }
コード例 #24
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]);
        }
コード例 #25
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);
        }
コード例 #26
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();
        }
コード例 #27
0
        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;
            }
        }
コード例 #28
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));
            }
        }
    }
コード例 #29
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);
            }
        }
    }
コード例 #30
0
    private bool CheckSelection()
    {
        selectedPoints.Clear();

        foreach (GameObject item in Selection.objects)
        {
            selectedPoints.Add(item.GetComponent <GraphPoint>());
        }

        if (selectedPoints.Count != 2)
        {
            GDebug.LogError("Выбери две вершины!");
        }

        return(selectedPoints.Count == 2);
    }