Exemple #1
0
    public void ManyGold()
    {
#if BLACK_ADMIN
        BlackContext.instance.SetGold(UInt128.MaxValue);
        BlackLogManager.Add(BlackLogEntry.Type.GoldAddAdmin, 1, UInt128.MaxValue.ToClampedLong());
#endif
    }
Exemple #2
0
    public void Gem(int amount)
    {
#if BLACK_ADMIN
        BlackContext.instance.AddFreeGem((uint)amount);
        BlackLogManager.Add(BlackLogEntry.Type.GemAddAdmin, 2, amount);
#endif
    }
Exemple #3
0
    public void GemToZero()
    {
#if BLACK_ADMIN
        BlackContext.instance.SetGemZero();
        BlackLogManager.Add(BlackLogEntry.Type.GemToZero, 0, 0);
#endif
    }
Exemple #4
0
    public async void ReportPlayLogAsync()
    {
        // 유저용 응급 기능이다. BLACK_ADMIN으로 감싸지 말것.
        try
        {
            // 저장 한번 하고
            SaveLoadManager.Save(BlackContext.instance, ConfigPopup.instance, Sound.instance, Data.instance, null);
            // 제출 시작한다.
            var reasonPhrase = await BlackLogManager.DumpAndUploadPlayLog("\\플레이 로그 업로드 중...".Localized(), "", "", "");

            if (string.IsNullOrEmpty(reasonPhrase))
            {
                var errorDeviceId = ErrorReporter.instance.GetOrCreateErrorDeviceId();
                var msg           = "\\플레이 로그 업로드가 성공적으로 완료됐습니다.\\n\\n업로드 코드: {0}".Localized(errorDeviceId);
                ConfirmPopup.instance.Open(msg);
            }
            else
            {
                throw new Exception(reasonPhrase);
            }
        }
        catch (Exception e)
        {
            var msg = "\\플레이 로그 업로드 중 오류가 발생했습니다.\\n\\n{0}".Localized(e.Message);
            Debug.LogException(e);
            ConfirmPopup.instance.Open(msg);
        }
        finally
        {
            ProgressMessage.instance.Close();
        }
    }
Exemple #5
0
 void OnEnable()
 {
     if (BlackContext.instance != null)
     {
         BlackContext.instance.CheatMode = true;
         BlackLogManager.Add(BlackLogEntry.Type.GameCheatEnabled, 0, 0);
     }
 }
Exemple #6
0
    static bool SaveBlackSaveData(BlackSaveData blackSaveData)
    {
        //ConDebug.LogFormat("Start Saving JSON Data: {0}", JsonUtility.ToJson(blackSaveData));
        var saveDataArray = MessagePackSerializer.Serialize(blackSaveData, Data.DefaultOptions);

        ConDebug.LogFormat("Saving path: {0}", SaveFileName);
        if (lastSaveDataArray != null && lastSaveDataArray.SequenceEqual(saveDataArray))
        {
            ConDebug.LogFormat("Saving skipped since there is no difference made compared to last time saved.");
        }
        else
        {
            try
            {
                // 진짜 쓰자!!
                WriteAllBytesAtomically(SaveFileName, saveDataArray);

                // 마지막 저장 데이터 갱신
                lastSaveDataArray = saveDataArray;
                ConDebug.Log($"{SaveFileName} Saved. (written to disk)");

                // 유저 서비스를 위해 필요할 수도 있으니까 개발 중일 때는 base64 인코딩 버전 세이브 파일도 저장한다.
                // 실서비스 버전에서는 불필요한 기능이다.
                if (Application.isEditor)
                {
                    var base64Path = SaveFileName + ".base64.txt";
                    ConDebug.LogFormat("Saving path (base64): {0}", base64Path);
                    File.WriteAllText(base64Path, Convert.ToBase64String(saveDataArray));
                    ConDebug.Log($"{base64Path} Saved. (written to disk)");
                }

                IncreaseSaveDataSlotAndWrite();
                var lastBlackLevel = blackSaveData.lastClearedStageId;
                var gem            = (blackSaveData.freeGemScUInt128 + blackSaveData.paidGemScUInt128).ToUInt128()
                                     .ToClampedLong();
                BlackLogManager.Add(BlackLogEntry.Type.GameSaved, lastBlackLevel, gem);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                Debug.LogError("Writing to disk failed!!!");
                ConfirmPopup.instance.Open("Writing to disk failed!!!");
                BlackLogManager.Add(BlackLogEntry.Type.GameSaveFailure, 0, 0);
                return(false);
            }
        }

        return(true);
    }
Exemple #7
0
        public List <BlackLogEntry> Read(int startOffset, int logEntryStartIndex, int count)
        {
            var logEntryList       = new List <BlackLogEntry>();
            var dummyLogEntryBytes = BlackLogManager.GetLogEntryBytes(BlackLogEntry.Type.GameLoaded, 0, 0);

            readLogStream.Seek(startOffset + logEntryStartIndex * dummyLogEntryBytes.Length, SeekOrigin.Begin);
            var bytes         = new byte[count * dummyLogEntryBytes.Length];
            var readByteCount = readLogStream.Read(bytes, 0, bytes.Length);
            var offset        = 0;

            for (var i = 0; i < readByteCount / dummyLogEntryBytes.Length; i++)
            {
                logEntryList.Add(new BlackLogEntry
                {
                    ticks = BitConverter.ToInt64(bytes, offset + 0),
                    type  = BitConverter.ToInt32(bytes, offset + 0 + 8),
                    arg1  = BitConverter.ToInt32(bytes, offset + 0 + 8 + 4),
                    arg2  = BitConverter.ToInt64(bytes, offset + 0 + 8 + 4 + 4)
                });
                offset += dummyLogEntryBytes.Length;
            }

            return(logEntryList);
        }
Exemple #8
0
        public long Count()
        {
            var dummyLogEntryBytes = BlackLogManager.GetLogEntryBytes(BlackLogEntry.Type.GameLoaded, 0, 0);

            return(readLogStream.Length / dummyLogEntryBytes.Length);
        }
Exemple #9
0
 // 유저가 직접 공지사항을 확인하려고 할 때 호출된다.
 // 공지사항 창이 열린다.
 public void Open()
 {
     BlackLogManager.Add(BlackLogEntry.Type.GameOpenNotice, 0, 0);
     //StopAllCoroutines();
     StartCoroutine(CheckNoticeCoro(false, null, null, null));
 }
Exemple #10
0
 void Awake()
 {
     instance       = this;
     writeLogStream = File.Open(LogFilePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
 }