コード例 #1
0
    public bool CreateBullet(string szBullet_KIND, NkBattleChar pkSourceChar, NkBattleChar pkTargetchar, float fStartTime)
    {
        if (szBullet_KIND == null)
        {
            return(false);
        }
        BULLET_INFO bulletInfo = this.GetBulletInfo(szBullet_KIND);

        if (bulletInfo == null)
        {
            if (TsPlatform.IsEditor)
            {
                Debug.LogError("Bullet Create Fail " + pkSourceChar.Get3DName() + " Kind : " + szBullet_KIND);
            }
            else
            {
                TsLog.Assert(false, "Bullet Create Fail " + pkSourceChar.Get3DName() + " Kind : " + szBullet_KIND, new object[0]);
            }
            return(false);
        }
        NkBulletUnit nkBulletUnit = new NkBulletUnit();

        if (nkBulletUnit.CreateBulletUnit(bulletInfo, pkSourceChar, pkTargetchar, fStartTime))
        {
            uint key = this._GetNextRegistNum();
            this.m_kBulletList.Add(key, nkBulletUnit);
            return(true);
        }
        return(false);
    }
コード例 #2
0
 public ObjectPoolKey(Type type, int size)
 {
     TsLog.Assert(size > 0, "ObjectPool size invalide val={0}", new object[]
     {
         size
     });
     this.m_Type  = type;
     this.m_iSize = size;
 }
コード例 #3
0
 private object AcquireOrGrow_I()
 {
     if (this.m_reuseStack.Count <= 0)
     {
         this.GrowPool_I();
     }
     TsLog.Assert(this.m_reuseStack.Count > 0, "{0}<{1}>: Fail! Growing.", new object[]
     {
         base.GetType().Name,
         this.m_opAttribute.typeName
     });
     return(this.m_reuseStack.Pop());
 }
コード例 #4
0
    public override void InitializeComponent()
    {
        TsLog.Assert(TsPlatform.IsMobile, "TsPlatform.IsMobile Only!", new object[0]);
        this.m_deYes      = null;
        this.m_deNo       = null;
        this.m_oYesObject = null;
        this.m_oNoObject  = null;
        UIBaseFileManager instance = NrTSingleton <UIBaseFileManager> .Instance;
        Form form = this;

        base.Scale   = true;
        base.TopMost = true;
        instance.LoadFileAll(ref form, "Message/DLG_IntroMsgBox", G_ID.INTROMSGBOX_DLG, true);
    }
コード例 #5
0
        private static T Acquire <T>(ObjectPoolKey data, object param) where T : class, IPoolObject
        {
            Type typeFromHandle = typeof(T);
            IObjectPoolContainer objectPoolContainer = ObjectPoolManager.I_GetObjectPoolContainer(data);

            TsLog.Assert(objectPoolContainer != null, "ObjectPoolConatiner is not found for {0} class.", new object[]
            {
                typeFromHandle.Name
            });
            T t = (T)((object)null);

            if (objectPoolContainer == null)
            {
                TsLog.Assert(false, "ObjectPoolManager. Class {0} poolContainer is null", new object[]
                {
                    typeFromHandle.Name
                });
            }
            else if (objectPoolContainer.objectPoolAttr == null)
            {
                TsLog.Assert(false, "ObjectPoolManager. ObjectPoolAttribute for class {0} is null", new object[]
                {
                    typeFromHandle.Name
                });
            }
            else if (objectPoolContainer.objectPoolAttr.CreateObjectStaticPrivate == null)
            {
                TsLog.Assert(false, "{0} class ObjectPoolAttribute.CreateInstance is not found!", new object[]
                {
                    typeFromHandle.Name
                });
            }
            else
            {
                t = (objectPoolContainer.Acquire() as T);
                if (t == null)
                {
                    TsLog.LogError("ObjectPoolManager.Acquire<T>(). Fail creation {0}.", new object[]
                    {
                        typeFromHandle.Name
                    });
                }
                else
                {
                    t.OnCreate(param);
                }
            }
            return(t);
        }
コード例 #6
0
        public void SetSkipLoad()
        {
            this.m_bLoadedOrSkipped = true;
            string basePath = NrTSingleton <NrGlobalReference> .Instance.basePath;
            string message  = string.Format("Skip to load \"{0}/{1}\" file.", basePath, PatchFinalList.filename);

            if (basePath.Contains("DESIGN") || !NrTSingleton <NrGlobalReference> .Instance.useCache)
            {
                TsLog.LogWarning(message, new object[0]);
            }
            else
            {
                TsLog.Assert(false, message, new object[0]);
            }
        }
コード例 #7
0
 public static void SetSkipMainStep(int skipCntMainStep)
 {
     TsLog.Assert(0 <= skipCntMainStep && skipCntMainStep < 5, "Invalid Progress Skip Count", new object[0]);
     NrLoadPageScreen._mainStepMax = skipCntMainStep;
     NrLoadPageScreen._mainStepCnt = 0;
     if (skipCntMainStep == 0)
     {
         NrLoadPageScreen._mainStepRatio = 1f;
     }
     else
     {
         NrLoadPageScreen._mainStepRatio = 1f / (float)NrLoadPageScreen._mainStepMax;
     }
     NrLoadPageScreen.ResetProgress(1f);
 }
コード例 #8
0
    public static WWW LoadFromCacheOrDownload(string url, int version, long fileSize, WWWItem wItem)
    {
        CustomCaching.CacheItem cacheItem;
        string arg;
        bool   flag = CustomCaching._IsVersionCached(url, version, out cacheItem, out arg);
        WWW    wWW;

        if (flag)
        {
            if (cacheItem.wref != null && cacheItem.wref.Target != null)
            {
                TsLog.Assert(cacheItem.wref.IsAlive, "CustomCaching: Duplicated request! but WWW reference is removed! (url=\"{0}\")", new object[]
                {
                    cacheItem.url
                });
                wWW = cacheItem.wref.CastedTarget;
            }
            else
            {
                string url2 = string.Format("file://{0}", arg);
                wWW = new WWW(url2);
            }
        }
        else
        {
            wWW = new WWW(url);
            if (cacheItem == null)
            {
                if (CustomCaching._cacheList.TryGetValue(wItem.assetPath, out cacheItem))
                {
                    TsLog.LogWarning("CustomCaching. Duplicated cache list item (path=\"{0}\")", new object[]
                    {
                        wItem.assetPath
                    });
                }
                cacheItem     = new CustomCaching.CacheItem();
                cacheItem.url = wItem.assetPath;
            }
            cacheItem.wref    = wWW;
            cacheItem.version = version;
            cacheItem.size    = fileSize;
            wItem.SetCallback(new PostProcPerItem(CustomCaching.CallbackSaveAssetBundle), cacheItem);
        }
        return(wWW);
    }
コード例 #9
0
    public void SetPlatformPath()
    {
        string text = string.Empty;

        if (TsPlatform.IsEditor)
        {
            text = string.Format("{0}/Mobile/", NrTSingleton <NrGlobalReference> .Instance.basePath);
        }
        else if (TsPlatform.IsIPhone)
        {
            text = string.Format("{0}/at2/cacheroot/", TsPlatform.Operator.GetFileDir());
        }
        else if (TsPlatform.IsAndroid)
        {
            text = string.Format("{0}/at2/cacheroot/", TsPlatform.Operator.GetFileDir());
        }
        else
        {
            TsLog.Assert(false, "Unknown Platform", new object[0]);
        }
        this.m_strLocalFilePath = text;
        Option.SetProtocolRootPath(Protocol.FILE, text);
        UnityEngine.Debug.LogWarning("StageNPatchLauncher : " + text);
        this.m_strWebPath = Option.GetProtocolRootPath(Protocol.HTTP);
        TsLog.LogWarning("HttpPath[{0}] Cachepath[{1}]", new object[]
        {
            this.m_strWebPath,
            text
        });
        TsPlatform.FileLog("HttpPath = " + this.m_strWebPath + ", CacheDpath = " + text);
        NrTSingleton <NrGlobalReference> .Instance.localWWW = true;
        NrTSingleton <NrGlobalReference> .Instance.useCache = true;
        TsCaching.InitiailzeCustomCaching(this.m_strWebPath, text);
        Caching.maximumAvailableDiskSpace = (long)(1048576 * StageNPatchLauncher.UNITY_CACHE_SIZE);
        if (TsPlatform.IsAndroid)
        {
            NrTSingleton <NrGlobalReference> .Instance.STR_MOBILE_VER = TsPlatform.APP_VERSION_AND;
        }
        else if (TsPlatform.IsIPhone || TsPlatform.IsIPad())
        {
            NrTSingleton <NrGlobalReference> .Instance.STR_MOBILE_VER = TsPlatform.APP_VERSION_IOS;
        }
    }
コード例 #10
0
        public ObjectPoolAttribute(Type classType, int initCount, int initCapacity, int limitCount)
        {
            this.typeName     = classType.Name;
            this.initCapacity = initCapacity;
            this.initCount    = initCount;
            this.limitCount   = limitCount;
            this.CheckPoolCounter_I();
            MethodInfo method = classType.GetMethod("CreateInstanceStaicPrivate", BindingFlags.Static | BindingFlags.NonPublic);

            if (method == null)
            {
                TsLog.Assert(method != null, "{0} ObjectPoolAttribute. Create callback not found", new object[]
                {
                    this.typeName
                });
            }
            else
            {
                Delegate @delegate = Delegate.CreateDelegate(typeof(Func <object>), classType, "CreateInstanceStaicPrivate");
                this.CreateObjectStaticPrivate = (@delegate as Func <object>);
                TsLog.Assert(this.CreateObjectStaticPrivate != null, "{0} ObjectPoolAttribute. static private create method({1}) not found.", new object[]
                {
                    this.typeName,
                    "CreateInstanceStaicPrivate"
                });
                Type typeFromHandle = typeof(StackObjectPool);
                method = typeFromHandle.GetMethod("CreateInstanceStaicPrivate", BindingFlags.Static | BindingFlags.NonPublic);
                if (method == null)
                {
                    TsLog.Assert(method != null, "{0} ObjectPoolAttribute. static private method not found in the class {1}", new object[]
                    {
                        typeFromHandle.Name,
                        "CreateInstanceStaicPrivate"
                    });
                }
                else
                {
                    @delegate = Delegate.CreateDelegate(typeof(Func <ObjectPoolAttribute, IObjectPoolContainer>), typeFromHandle, "CreateInstanceStaicPrivate");
                    this.CreatePoolContainerStaticPrivate = (@delegate as Func <ObjectPoolAttribute, IObjectPoolContainer>);
                }
            }
        }
コード例 #11
0
        public float GetUpdateDiff(float prgrs)
        {
            TsLog.Assert(0f <= prgrs && prgrs <= 1f, "PROGRESS value invalid {0}", new object[]
            {
                prgrs
            });
            float num = prgrs * (float)this.divide;

            this.difference = num - this.iprogress;
            float num2 = 1f - this.ratio;

            if (this.difference == 0f && prgrs < num2)
            {
                num += this.ratio * (float)this.divide;
                if (num > num2)
                {
                    num = num2;
                }
                this.difference = num - this.iprogress;
            }
            this.iprogress = num;
            return(this.difference);
        }
コード例 #12
0
 public void OnCreate(object param)
 {
     this.callback = (param as PostProcPerItem);
     TsLog.Assert(param != null, "WWWDownloader.OnCreate(param) param is null!", new object[0]);
 }
コード例 #13
0
 private static void CallbackSaveAssetBundle(IDownloadedItem wItem, object obj)
 {
     try
     {
         CustomCaching.CacheItem cacheItem = obj as CustomCaching.CacheItem;
         if (cacheItem == null)
         {
             TsLog.LogWarning("CacheItem not found. (assetPath=\"{0}\")", new object[]
             {
                 wItem.assetPath
             });
         }
         else if (!wItem.isCanceled && string.IsNullOrEmpty(wItem.errorString))
         {
             string   text  = string.Format("{0}{1}", CustomCaching._locRoot, wItem.assetPath);
             string[] array = text.Split(new char[]
             {
                 '/'
             });
             StringBuilder stringBuilder = new StringBuilder();
             for (int i = 0; i < array.Length - 1; i++)
             {
                 stringBuilder.AppendFormat("{0}{1}", array[i], '/');
                 string path = stringBuilder.ToString();
                 if (!Directory.Exists(path))
                 {
                     Directory.CreateDirectory(path);
                 }
             }
             try
             {
                 if (wItem.rawBytes == null)
                 {
                     throw new NullReferenceException(string.Format("[CustomCache] wItem.rawBytes is null. (path=\"{0}\")\n", wItem.assetPath));
                 }
                 cacheItem.isExistLocalFile = false;
                 if (File.Exists(text))
                 {
                     File.Delete(text);
                 }
                 using (FileStream fileStream = File.Create(text))
                 {
                     using (BinaryWriter binaryWriter = new BinaryWriter(fileStream, Encoding.UTF8))
                     {
                         byte[] rawBytes = wItem.rawBytes;
                         binaryWriter.Write(rawBytes, 0, rawBytes.Length);
                         long num = (long)rawBytes.Length;
                         CustomCaching._spaceOccupied += cacheItem.size;
                         if (num != cacheItem.size)
                         {
                             TsLog.LogError("Not Match File={0} OrgSize={1} DownSize={2}", new object[]
                             {
                                 wItem.assetPath,
                                 cacheItem.size,
                                 num
                             });
                             if (CustomCaching._cacheList.ContainsKey(cacheItem.url))
                             {
                                 CustomCaching._cacheList.Remove(cacheItem.url);
                             }
                             if (File.Exists(text))
                             {
                                 File.Delete(text);
                             }
                         }
                         else if (!CustomCaching._cacheList.ContainsKey(cacheItem.url))
                         {
                             CustomCaching._cacheList.Add(wItem.assetPath, cacheItem);
                         }
                         else
                         {
                             CustomCaching._cacheList.Remove(cacheItem.url);
                             CustomCaching._cacheList.Add(wItem.assetPath, cacheItem);
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
                 CustomCaching._RemoveCacheItem(cacheItem.url);
                 TsLog.Assert(false, "Cache file save error! (Path=\"{1}\") : {0}", new object[]
                 {
                     ex,
                     text
                 });
             }
             cacheItem.wref = null;
         }
         else
         {
             CustomCaching._RemoveCacheItem(cacheItem.url);
             TsLog.LogError("CustomCaching. Error file saving (url=\"{0}\", error={1}, canceled={2})", new object[]
             {
                 cacheItem.url,
                 wItem.errorString,
                 wItem.isCanceled
             });
         }
         TsCaching.SaveCacheList();
     }
     catch (Exception obj2)
     {
         TsLog.LogWarning(obj2);
     }
 }
コード例 #14
0
        public void _InternalOnly_ChangeStateErrorOrRetry(string error)
        {
            string text = string.Format("{5}\t[TsBundle] {0} (AssetPath=\"{1}\", Stack=\"{2}\", Type={3})\r\nRequestCallStack=\"{4}\"", new object[]
            {
                error,
                this.assetPath,
                this.stackName,
                this.itemType,
                this.RequestCallStack,
                Scene.CurScene.ToString()
            });

            if (TsPlatform.IsMobile)
            {
                TsPlatform.FileLog(text);
            }
            if (error.Contains("404 Not Found"))
            {
                TsLog.LogWarning(text, new object[0]);
                this.wiState        = WWWItem.StateWI.ERROR;
                this.isFileNotFound = true;
            }
            else if (error.Contains("Exception!"))
            {
                this.wiState = WWWItem.StateWI.ERROR;
            }
            else
            {
                int num = 2;
                if (string.IsNullOrEmpty(this.anotherURL))
                {
                    if (TsPlatform.IsMobile)
                    {
                        num = 5;
                    }
                }
                else
                {
                    TsLog.LogWarning(text, new object[0]);
                }
                if (!this.retryRequested)
                {
                    if (!Option.isPause && this.retryCnt >= num)
                    {
                        if (string.IsNullOrEmpty(this.anotherURL))
                        {
                            string text2 = string.Format("{6}\t[TsBundle] Retry: {5} - {0} (AssetPath=\"{1}\", Stack=\"{2}\", Type={3})\r\nRequestCallStack=\"{4}\"", new object[]
                            {
                                error,
                                this.assetPath,
                                this.stackName,
                                this.itemType,
                                this.RequestCallStack,
                                this.retryCnt,
                                Scene.CurScene.ToString()
                            });
                            TsLog.Assert(false, text2, new object[0]);
                            if (WWWItem._errorCallback != null)
                            {
                                WWWItem._errorCallback(text2);
                            }
                            if (TsPlatform.IsMobile)
                            {
                                TsPlatform.FileLog(text2);
                            }
                        }
                        this.wiState = WWWItem.StateWI.ERROR;
                    }
                    else
                    {
                        this.wiState = WWWItem.StateWI.CREATED;
                    }
                }
            }
        }
コード例 #15
0
    public static TsAudioAdapter TryToAddAdapter(GameObject go, TsAudio audioEx)
    {
        if (go == null)
        {
            return(null);
        }
        TsAudioAdapter tsAudioAdapter = go.GetComponent <TsAudioAdapter>();

        if (tsAudioAdapter != null && tsAudioAdapter.AudioType != audioEx.baseData.AudioType)
        {
            UnityEngine.Object.DestroyImmediate(tsAudioAdapter);
            tsAudioAdapter = null;
        }
        if (tsAudioAdapter == null)
        {
            if (go.audio != null)
            {
                go.audio.playOnAwake = false;
            }
            switch (audioEx.baseData.AudioType)
            {
            case EAudioType.SFX:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterSFX>();
                break;

            case EAudioType.BGM:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterBGM>();
                break;

            case EAudioType.AMBIENT:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterAmbient>();
                break;

            case EAudioType.UI:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterUI>();
                break;

            case EAudioType.VOICE:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterVoice>();
                break;

            case EAudioType.SYSTEM:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterSystem>();
                break;

            case EAudioType.GAME_DRAMA:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterGameDrama>();
                break;

            case EAudioType.ENVIRONMENT:
                tsAudioAdapter = go.AddComponent <TsAudioAdapterEnvironment>();
                break;

            default:
                TsLog.Assert(false, "Check the AudioType~!!! Invalid Type= {0}", new object[]
                {
                    audioEx.baseData.AudioType
                });
                break;
            }
        }
        if (tsAudioAdapter == null)
        {
            TsLog.LogError("Check the EAudioType~! is Invaild Value EAudioType = " + audioEx.baseData.AudioType, new object[0]);
            return(null);
        }
        if (!tsAudioAdapter._InitAudioEx(audioEx))
        {
            UnityEngine.Object.Destroy(tsAudioAdapter);
            return(null);
        }
        audioEx.CheckAndSetNeedRefs(tsAudioAdapter);
        return(tsAudioAdapter);
    }
コード例 #16
0
 private static void _DecToken()
 {
     TsBundleService.ms_totToken--;
     TsBundleService.ms_lastFrame = Time.frameCount;
     TsLog.Assert(TsBundleService.ms_totToken >= 0, "TsBundle token count is out of bound!", new object[0]);
 }