Beispiel #1
0
            public static string GetCurrentVersionCode()
            {
#if UNITY_ANDROID
                AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                if (jc == null)
                {
                    return(null);
                }
                AndroidJavaObject m_jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
                if (m_jo == null)
                {
                    return(null);
                }
                AndroidJavaClass clazz = new AndroidJavaClass("com.tencent.gcloud.dolphin.CuIIPSMobile");
                if (clazz == null)
                {
                    return(null);
                }
                string apkpath = clazz.CallStatic <string>("getVersionCode", m_jo);
                if (apkpath == "error")
                {
                    ADebug.LogError("[ApolloUpdate] getVersionCode failed");
                    return(null);
                }
                else
                {
                    ADebug.Log(string.Format("[ApolloUpdate] getVersionCode success  path:{0}", apkpath));
                    return(apkpath);
                }
#else
                return(null);
#endif
            }
Beispiel #2
0
        void OnReadyProc(byte[] data)
        {
            ADebug.Log("OnReadyProc");

            if (data != null)
            {
                LockStepResult result = new LockStepResult();
                if (result.Decode(data))
                {
                    if (readyEventHandler != null)
                    {
                        readyEventHandler(result);
                    }

                    if (result.IsSuccess())
                    {
                        hasReady = true;
                    }
                }
                else
                {
                    ADebug.LogError("OnReadyProc Decoce Error");
                }
            }
            else
            {
                ADebug.LogError("OnReadyProc data is null");
            }
        }
Beispiel #3
0
            public static string GetFirstExtractIfsPath(bool bFirst_source_in_apk, bool bObb_type)
            {
#if UNITY_ANDROID
                string apkpath = null;
                if (bFirst_source_in_apk)
                {
                    apkpath = GetCurrentVersionApkPath();//
                }
                else
                {
                    string versioncode = GetCurrentVersionCode();
                    string bundleid    = GetCurrentBundleId();
                    if (versioncode == null || bundleid == null)
                    {
                        return(null);
                    }
                    apkpath = GetCurrentVersionObbPath() + (bObb_type ? "/main.":"/patch.") + versioncode + "." + bundleid + ".obb";
                }

                if (apkpath == null)
                {
                    return(null);
                }

                // string configifspath = "apk://"+apkpath + "?assets/first_source.png";
                string configifspath = "apk://" + apkpath + "?assets/first_source.png";
                ADebug.Log(string.Format("configapkpath:{0}", configifspath));
                return(configifspath);
#elif UNITY_IOS
                string configifspath = Application.streamingAssetsPath + "/first_source.png";
                if (File.Exists(configifspath))
                {
                    ADebug.Log(string.Format("ifs exist,configapkpath:{0}", configifspath));
                }
                else
                {
                    ADebug.LogError(string.Format("ifs not exist,configapkpath:{0}", configifspath));
                    return(null);
                }
                return(configifspath);
#else
                string configifspath = Application.dataPath + "/StreamingAssets/first_source.png";
                if (File.Exists(configifspath))
                {
                    ADebug.Log(string.Format("ifs exist,configapkpath:{0}", configifspath));
                }
                else
                {
                    ADebug.LogError(string.Format("ifs not exist,configapkpath:{0}", configifspath));
                    return(null);
                }
                return(configifspath);
#endif
            }
Beispiel #4
0
        public bool Initialize(LockStepInitializeInfo initInfo, IBufferStrategy bufferStrategy)
        {
            // just want to initialize Gcloud
            IGCloud gcloud = IGCloud.Instance;

            ADebug.Log("Initialize" + (gcloud == null));

            if (initInfo != null)
            {
                this.initInfo = initInfo;

                byte[] buffer;
                if (initInfo.Encode(out buffer) && buffer != null)
                {
                    bool ret = gcloud_lockstep_init(buffer, buffer.Length);
                    if (!ret)
                    {
                        return(false);
                    }
                }
                else
                {
                    ADebug.LogError("LockStep Initialize Encode error");
                    return(false);
                }
            }
            else
            {
                ADebug.LogError("LockStep Initialize is null");
                return(true);
            }

            if (bufferStrategy != null)
            {
                this.bufferStrategy = bufferStrategy;
            }
            else
            {
                this.bufferStrategy = new DefaultBufferStrategy();
            }

            if (this.bufferStrategy != null)
            {
                this.bufferStrategy.Steper = this;
            }

            return(true);
        }
Beispiel #5
0
            private string getIFSConfig()
            {
                if (mInitinfo == null)
                {
                    ADebug.LogError("[DataIFS]  mInitinfo is null");
                    return(null);
                }

                string haspassword = "******";

                if (mInitinfo.isHasPwd)
                {
                    haspassword = "******";
                }

                string config = string.Format(@"
		        {{
		            ""ifs"" : 
		            {{
		                ""filelist"" : 
		                [
		                   {{
		                        ""filemetaurl"" : """",
		                        ""filename"" : ""{1}"",
		                        ""filepath"" : ""{0}"",
		                        ""filesize"" : {2},
		                        ""readonly"" : true,
		                        ""resfilename"" : """",
		                        ""url"" : ""{0}""
		                    }}
		                 ],
		                  ""hasifs"" : true,
		                  ""password"" : 
			              {{
		                     ""haspassword"" : {3},
		                     ""value"" : ""{4}""
		                  }}
		             }}
		         }}"        , mInitinfo.ifspath, mInitinfo.ifsname, mInitinfo.ifsFileSize, haspassword, mInitinfo.password);

                ADebug.Log(config);
                return(config);
            }
Beispiel #6
0
            public bool Init(DataIFSInitInfo initinfo)
            {
                ADebug.Log(string.Format("[ApolloUpdate] initupdatemgr ifspath:{0},ifsname:{1},ifsFileSize:{2}"
                                         , initinfo.ifspath, initinfo.ifsname, initinfo.ifsFileSize));

                mFactory = new IIPSMobile.IIPSMobileData();

                mInitinfo.ifsname     = initinfo.ifsname;
                mInitinfo.ifspath     = initinfo.ifspath;
                mInitinfo.ifsFileSize = initinfo.ifsFileSize;
                mInitinfo.isHasPwd    = initinfo.isHasPwd;
                mInitinfo.password    = initinfo.password;

                if (mFactory == null)
                {
                    ADebug.LogError("[DataIFS] new mFactory fail");
                    return(false);
                }
                string config = getIFSConfig();

                mgr = mFactory.CreateDataMgr(config);
                if (mgr == null)
                {
                    ADebug.LogError("[DataIFS] new data mgr fail,Please check init param format!");
                    return(false);
                }
                mReader = mgr.GetDataReader();
                if (mReader == null)
                {
                    ADebug.LogError("[DataIFS]  GetDataReader fail");
                    return(false);
                }
                mFinder = mgr.GetDataQuery();
                if (mFinder == null)
                {
                    ADebug.LogError("[DataIFS]  GetDataQuery fail");
                    return(false);
                }
                return(true);
            }
Beispiel #7
0
 void OnStateChangedProc(int state, byte[] data)
 {
     ADebug.Log("OnStateChangedProc:" + state);
     if (data != null)
     {
         LockStepResult result = new LockStepResult();
         if (result.Decode(data))
         {
             if (StateChangedEvent != null)
             {
                 StateChangedEvent((LockStepState)state, result);
             }
         }
         else
         {
             ADebug.LogError("OnStateChangedProc Decoce Error");
         }
     }
     else
     {
         ADebug.LogError("OnStateChangedProc data is null");
     }
 }
Beispiel #8
0
        void OnLogoutProc(byte[] data)
        {
            ADebug.Log("OnLogoutProc");

            if (data != null)
            {
                LockStepResult result = new LockStepResult();
                if (result.Decode(data))
                {
                    if (logoutEventHandler != null)
                    {
                        logoutEventHandler(result);
                    }
                }
                else
                {
                    ADebug.LogError("OnLogoutProc Decoce Error");
                }
            }
            else
            {
                ADebug.LogError("OnLogoutProc data is null");
            }
        }
Beispiel #9
0
 public static bool InnerInstall()
 {
     ADebug.Log("InnerInstall");
     return(Instance.Install());
 }
Beispiel #10
0
 void OnRecvedFrameProc(int numberOfReceivedFrames)
 {
     ADebug.Log("OnRecvedFrameProc:" + numberOfReceivedFrames);
 }