Beispiel #1
0
    private IEnumerator WWWDownLoad(string url, string filePath, int index)
    {
        ResData downLoadDataInfo = downLoadingDataInfoArray[index];

        if (downLoadDataInfo != null)
        {
            float  time    = Time.realtimeSinceStartup;
            string downUrl = serverurl + url;

            WWW www = new WWW(Uri.EscapeUriString(downUrl));
            yield return(www);

            mDownLoadedIndex++;

            if (string.IsNullOrEmpty(www.error))
            {
                try
                {
                    byte[]     bBuffer        = www.bytes;
                    int        nRealReadCount = bBuffer.Length;
                    FileStream filestream     = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
                    try
                    {
                        filestream.Position = 0L;
                        filestream.Write(bBuffer, 0, nRealReadCount);
                        filestream.Flush();
                        filestream.Close();
                    }
                    finally
                    {
                        if (filestream != null)
                        {
                            filestream.Dispose();
                        }
                    }

                    //下载完之后开始文件拷贝
                    FileInfo finfo         = new FileInfo(filePath);
                    string   targetpath    = string.Format("{0}{1}", mLocalDataFolder, downLoadDataInfo.mDataPath);
                    string   directoryName = Path.GetDirectoryName(targetpath);
                    if (!Directory.Exists(directoryName))
                    {
                        Directory.CreateDirectory(directoryName);
                    }
                    if (File.Exists(targetpath))
                    {
                        File.Delete(targetpath);
                    }
                    finfo.MoveTo(targetpath);
                    FileDownLoaded(index.ToString());
                    GameDebug.Log("copy time = " + ((Time.realtimeSinceStartup - time)).ToString("0.000") + "s, url = " + downUrl);
                }
                catch (Exception exception)
                {
                    GameDebug.LogError("url = " + url + ", filePath = " + filePath + ",  " + exception.ToString());
                }
            }
        }
    }
Beispiel #2
0
 public void openWebView(string url)
 {
     GameDebug.Log("openWebView   : " + url);
     using (AndroidJavaClass javaClass = new AndroidJavaClass("com.ucweb.db.xlib.WebViewBridge"))
     {
         javaClass.CallStatic("openWebView", url);
     }
 }
Beispiel #3
0
 protected override void OnRespond(respond_update_wing respond, object userdata)
 {
     if (respond.result == (int)ERROR_CODE.ERR_WING_UPDATE_OK)
     {
         GameDebug.Log("更新翅膀数据");
         EventSystem.Instance.PushEvent(new WingUIEvent(WingUIEvent.Wing_UI_UPDATE));
     }
 }
    void UpdateMaterials()
    {
        var terrainImport = target as TerrainImport;
        var time          = stopwatch.Elapsed;

        UpdateAlphaMaps(terrainImport);
        GameDebug.Log("Material layers applied [" + (stopwatch.Elapsed - time).Milliseconds + "ms]");
    }
    void UpdateHeight()
    {
        var terrainImport = target as TerrainImport;
        var time          = stopwatch.Elapsed;

        UpdateHeight(terrainImport);
        GameDebug.Log("Height map applied [" + (stopwatch.Elapsed - time).Milliseconds + "ms]");
    }
Beispiel #6
0
    void OnApplicationQuit()
    {
#if !UNITY_EDITOR && UNITY_STANDALONE_WIN
        GameDebug.Log("Farewell, cruel world...");
        System.Diagnostics.Process.GetCurrentProcess().Kill();
#endif
        ShutdownGameLoops();
    }
Beispiel #7
0
    public void RequestGameLoop(System.Type type, string[] args)
    {
        GameDebug.Assert(typeof(IGameLoop).IsAssignableFrom(type));

        m_RequestedGameLoopTypes.Add(type);
        m_RequestedGameLoopArguments.Add(args);
        GameDebug.Log("Game loop " + type + " requested");
    }
Beispiel #8
0
 public void EnterFlow(UI_FLOW_TYPE flowType)
 {
     if (mFlowType != flowType)
     {
         mFlowType = flowType;
     }
     GameDebug.Log("UI进入流程  " + flowType.ToString());
 }
Beispiel #9
0
    private bool FinishAllQuest(ObjectBase obj, respond_msg_gm respond)
    {
        FinishQuestEvent evt = new FinishQuestEvent(FinishQuestEvent.QUEST_FINISHED_ALL);

        GameDebug.Log("gm finishall");
        EventSystem.Instance.PushEvent(evt);
        return(true);
    }
Beispiel #10
0
    private void OnAcceptQuestResponse(EventBase evt)
    {
        var qevt = evt as QuestEvent;

        mNetCache.Remove(qevt.mQuestId);
        GameDebug.Log("OnAcceptQuestResponse" + qevt.mQuestId);
        CheckCondition();
    }
Beispiel #11
0
 void Start()
 {
     mSprite = this.GetComponent <UISprite>();
     if (mSprite == null)
     {
         GameDebug.Log("UIAnimation 必须挂在UISprite上");
     }
 }
Beispiel #12
0
    //离开流程
    public void LeaveFlow(UI_FLOW_TYPE flowType)
    {
        GameDebug.Log("UI离开流程  " + flowType.ToString());

        DestroyFlowWindow(flowType);

        mFlowType = UI_FLOW_TYPE.UI_FLOW_INVAID;
    }
    protected override void OnUpdate()
    {
        if (RequestGroup.CalculateEntityCount() == 0)
        {
            return;
        }

        // Copy requests as spawning will invalidate Group
        requestBuffer.Clear();
        var requestArray       = RequestGroup.ToComponentDataArray <ProjectileRequest>(Allocator.Persistent);
        var requestEntityArray = RequestGroup.ToEntityArray(Allocator.Persistent);

        for (var i = 0; i < requestArray.Length; i++)
        {
            requestBuffer.Add(requestArray[i]);
            PostUpdateCommands.DestroyEntity(requestEntityArray[i]);
        }

        // Handle requests
        var projectileRegistry = m_resourceSystem.GetResourceRegistry <ProjectileRegistry>();

        foreach (var request in requestBuffer)
        {
            var registryIndex = projectileRegistry.FindIndex(request.projectileAssetGuid);
            if (registryIndex == -1)
            {
                GameDebug.LogError("Cant find asset guid in registry");
                continue;
            }

            // Create projectile and initialize
            var projectileEntity = m_settings.projectileFactory.Create(EntityManager, m_resourceSystem, null, 0);
            var projectileData   = EntityManager.GetComponentData <ProjectileData>(projectileEntity);

            projectileData.SetupFromRequest(request, registryIndex);
            projectileData.Initialize(projectileRegistry);
            EntityManager.SetComponentData(projectileEntity, projectileData);
            EntityManager.AddComponentData(projectileEntity, new PredictedProjectile(request.startTick));
            EntityManager.AddComponentData(projectileEntity, new UpdateProjectileFlag());

            if (ProjectileModuleClient.logInfo.IntValue > 0)
            {
                GameDebug.Log("New predicted projectile created: " + projectileEntity);
            }

            // Create client projectile
            var clientProjectileEntity = m_clientProjectileFactory.CreateClientProjectile(projectileEntity);
            EntityManager.AddComponentData(clientProjectileEntity, new UpdateProjectileFlag());

            if (ProjectileModuleClient.drawDebug.IntValue == 1)
            {
                Debug.DrawLine(projectileData.startPos, projectileData.endPos, Color.cyan, 1.0f);
            }
        }

        requestArray.Dispose();
        requestEntityArray.Dispose();
    }
Beispiel #14
0
    public void ProcessEntityUpdate(int serverTick, int id, ref NetworkReader reader)
    {
        if (m_showInfo.IntValue > 1)
        {
            GameDebug.Log("ApplyEntitySnapshot. ServerTick:" + serverTick + " entityId:" + id);
        }

        m_entityCollection.ProcessEntityUpdate(serverTick, id, ref reader);
    }
Beispiel #15
0
 public void OnMapUpdate(ref NetworkReader reader)
 {
     m_LevelName = reader.ReadString();
     GameDebug.Log("map : " + m_LevelName);
     if (_stateMachine.CurrentState() != ClientState.Loading)//in case map update when loading
     {
         _stateMachine.SwitchTo(ClientState.Loading);
     }
 }
Beispiel #16
0
    public void Shutdown()
    {
        GameDebug.Log("GameWorld " + world.Name + " shutting down");

        // Destroy functionalities and objects here...

        worlds.Remove(this);
        GameObject.Destroy(sceneRoot);
    }
Beispiel #17
0
        public static void ShowNormalNotice()
        {
            //这里先获取后台通告信息
            string loginNoticeUrl = GlobalConfig.GetInstance().LoginNoticeUrl;

            GameDebug.Log("获取游戏公告" + loginNoticeUrl);

            MainGame.HttpRequest.GET(loginNoticeUrl, OnGetLoginNoticeInfo, false);
        }
Beispiel #18
0
    /// <summary>
    /// 点击签到
    /// </summary>
    public void SignInClick()
    {
        GameDebug.Log("点击签到");
        signInPanel.gameObject.SetActive(true);
        DataLoader.enableclick = false;

        PlayerPrefs.DeleteAll();
        updateSignData();
    }
Beispiel #19
0
 protected override void Deinitialize(Entity entity, ReplicatedDataEntity component)
 {
     if (ReplicatedEntityModuleServer.m_showInfo.IntValue > 0)
     {
         GameDebug.Log("HandleReplicatedEntityDataDespawn.Deinitialize entity:" + entity + " type:" + component.typeId + " id:" + component.id);
     }
     m_entityCollection.Unregister(component.id);
     m_network.UnregisterEntity(component.id);
 }
Beispiel #20
0
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            inputDependencies.Complete();

            var animGraphSys = World.GetExistingSystem <AnimationGraphSystem>();

            // Initialize
            Entities
            .WithStructuralChanges()
            .WithNone <LOD>()
            .WithAll <Settings>()
            .ForEach((Entity entity) =>
            {
                GameDebug.Log(World, ShowLifetime, "InitSys: Initialize DotsAnimStateCtrl:{0}", entity);

                // Setup lowest LOD rig
                var rigDataBuffer = EntityManager.GetBuffer <RigData>(entity);
//                var lowestLod = rigDataBuffer.Length - 1;
                // TODO (mogensh) for now we only use Rig LOD for selecting low lod on server
                var isServer = World.GetExistingSystem <ServerSimulationSystemGroup>() != null;// TODO (mogensh) cant we find better way to test for server?
                var lod      = isServer ? 1 : 0;
                var rigData  = rigDataBuffer[lod];
                RigEntityBuilder.SetupRigEntity(entity, EntityManager, rigData.Rig);

                var animLocalToRigBuffer = EntityManager.AddBuffer <AnimatedLocalToRig>(entity);
                animLocalToRigBuffer.ResizeUninitialized(rigData.Rig.Value.Skeleton.Ids.Length);

                // Create root animsource
                var settings             = EntityManager.GetComponentData <Settings>(entity);
                var rootAnimSourceEntity = PrefabAssetManager.CreateEntity(EntityManager, settings.RootAnimSource);
#if UNITY_EDITOR
                var name = EntityManager.GetName(rootAnimSourceEntity) + " -> Entity " + entity.Index + ".DotsAnimStateController.RootAnimSource";
                EntityManager.SetName(rootAnimSourceEntity, name);
#endif
                AnimSource.SetAnimStateEntityOnPrefab(EntityManager, rootAnimSourceEntity, entity);

                var rootAnimSource   = RootAnimSource.Default;
                rootAnimSource.Value = rootAnimSourceEntity;
                EntityManager.AddComponentData(entity, rootAnimSource);

                EntityManager.AddComponentData(entity, new LOD {
                    Value = lod,
                });
            }).Run();


            // Deinitialize
            Entities
            .WithStructuralChanges()
            .WithNone <Settings>()
            .WithAll <LOD>()
            .ForEach((Entity entity, ref RootAnimSource rootAnimSource, ref OutputNode outputNode, ref GraphOutput graphOutput) =>
            {
                Deinitialize(EntityManager, entity, animGraphSys);
            }).Run();

            return(default);
Beispiel #21
0
 void HandleGameloopException(System.Exception e)
 {
     if (debugCatchLoop.IntValue > 0)
     {
         GameDebug.Log("EXCEPTION " + e.Message + "\n" + e.StackTrace);
         Console.SetOpen(true);
         m_ErrorState = true;
     }
 }
Beispiel #22
0
        /// <summary>
        /// 响应aoi消失的消息
        /// </summary>
        /// <param name="pack"></param>
        public void HandleUnitDisapper(S2CNwarDisappear pack)
        {
#if TEST_WILD_PROTOCOL
            if (IsPlayer(pack.uuid))
            {
                GameDebug.Log(">>>MSG_NWAR_DISAPPEAR player id = " + pack.uuid);
            }
            else if (IsSummon(pack.uuid))
            {
                GameDebug.Log(">>>MSG_NWAR_DISAPPEAR summon id = " + pack.uuid);
            }
            else
            {
                GameDebug.Log(">>>MSG_NWAR_DISAPPEAR monster id = " + pack.uuid);
            }
#endif

            var uuid = pack.uuid;

            // 不需要处理本地玩家的disappear
            if (uuid == Game.Instance.LocalPlayerID.obj_idx)
            {
                return;
            }

            // 如果是玩家或者人形怪
            if (ActorHelper.IsPlayer(uuid) || ActorHelper.IsShemale(uuid))
            {
                var player_info = GetWildPlayerInfo(uuid, false);
                if (player_info != null)
                {
                    player_info.HandleDisappear();

                    AddPlayerToDisappear(player_info);
                }
            }
            // 如果是召唤怪
            else if (ActorHelper.IsSummon(uuid))
            {
                var monster_info = GetWildMonsterInfo(uuid, false);
                if (monster_info != null)
                {
                    monster_info.HandleDisappear();
                    AddMonsterToDisappear(monster_info);
                }
            }
            // 如果是普通怪物
            else
            {
                var monster_info = GetWildMonsterInfo(uuid, false);
                if (monster_info != null)
                {
                    monster_info.HandleDisappear();
                    AddMonsterToDisappear(monster_info);
                }
            }
        }
Beispiel #23
0
 public void UnmountBank(SoundBank bank)
 {
     GameDebug.Assert(bank.soundDefs.Count == bank.soundDefGuids.Count);
     for (int i = 0, c = bank.soundDefGuids.Count; i < c; ++i)
     {
         m_SoundDefs.Remove(bank.soundDefGuids[i]);
     }
     GameDebug.Log("Unmounted soundbank: " + bank.name + " with " + bank.soundDefGuids.Count + " sounds");
 }
Beispiel #24
0
    public BundledResourceManager(GameWorld world, string registryName)
    {
        bool useBundles = !Application.isEditor || forceBundles.IntValue > 0;

        m_world = world;

#if UNITY_EDITOR
        if (!useBundles)
        {
            string assetPath = "Assets/" + registryName + ".asset";
            m_assetRegistryRoot = AssetDatabase.LoadAssetAtPath <AssetRegistryRoot>(assetPath);
            if (verbose.IntValue > 0)
            {
                GameDebug.Log("resource: loading resource: " + assetPath);
            }
        }
#endif

        if (useBundles)
        {
            var bundlePath = GetBundlePath();
            var assetPath  = bundlePath + "/" + registryName;

            if (verbose.IntValue > 0)
            {
                GameDebug.Log("resource: loading bundle (" + assetPath + ")");
            }
            m_assetRegistryRootBundle = AssetBundle.LoadFromFile(assetPath);

            var registryRoots = m_assetRegistryRootBundle.LoadAllAssets <AssetRegistryRoot>();

            if (registryRoots.Length == 1)
            {
                m_assetRegistryRoot = registryRoots[0];
            }
            else
            {
                GameDebug.LogError("Wrong number(" + registryRoots.Length + ") of registry roots in " + registryName);
            }
        }

        // Update asset registry map
        if (m_assetRegistryRoot != null)
        {
            foreach (var registry in m_assetRegistryRoot.assetRegistries)
            {
                if (registry == null)
                {
                    continue;
                }

                System.Type type = registry.GetType();
                m_assetRegistryMap.Add(type, registry);
            }
            m_assetResourceFolder = registryName + "_Assets";
        }
    }
Beispiel #25
0
 public UITableItem GetUIRes(string uiName)
 {
     if (!DataManager.UITable.ContainsKey(uiName))
     {
         GameDebug.Log("没有找到UI :" + uiName);
         return(null);
     }
     return(DataManager.UITable[uiName] as UITableItem);
 }
Beispiel #26
0
    SoundEmitter AllocEmitter()
    {
        // Look for unused emitter
        foreach (var e in m_Emitters)
        {
            if (!e.playing)
            {
                e.seqId = m_SequenceId++;
                return(e);
            }
        }

        // Hunt down one emitter to kill
        SoundEmitter emitter     = null;
        float        distance    = float.MinValue;
        var          listenerPos = m_CurrentListener != null ? m_CurrentListener.transform.position : Vector3.zero;

        foreach (var e in m_Emitters)
        {
            var s = e.source;

            // Skip looping
            if (s.loop)
            {
                continue;
            }

            // Pick closest; assuming 2d sounds very close!
            var dist = 0.0f;
            if (s.spatialBlend > 0.0f)
            {
                dist = (s.transform.position - listenerPos).magnitude;

                // if tracking another object assume closer
                var t = s.transform;
                if (t.parent != m_SourceHolder.transform)
                {
                    dist *= 0.5f;
                }
            }

            if (dist > distance)
            {
                distance = dist;
                emitter  = e;
            }
        }
        if (emitter != null)
        {
            emitter.Kill();
            emitter.seqId = m_SequenceId++;
            return(emitter);
        }
        GameDebug.Log("Unable to allocate sound emitter!");
        return(null);
    }
Beispiel #27
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps.Complete();

            var nodeSet              = m_AnimationGraphSystem.Set;
            var commands             = new EntityCommandBuffer(Allocator.TempJob);
            var animationGraphSystem = m_AnimationGraphSystem;

            Entities
            .WithoutBurst()     // Can be removed once NodeSets are Burst-friendly
            .WithNone <SystemState>()
            .ForEach((Entity entity, ref AnimSource.Data animSource, ref Settings settings) =>
            {
                GameDebug.Log(World, AnimSource.ShowLifetime, "Init KnockBack entity:{0} state entity:{1}", entity, animSource.animStateEntity);

                var state = SystemState.Default;

                state.MixerNode        = AnimationGraphHelper.CreateNode <LayerMixerNode>(animationGraphSystem, "MixerNode");
                state.ClipNode         = AnimationGraphHelper.CreateNode <ClipNode>(animationGraphSystem, "ClipNode");
                state.OffsetNode       = AnimationGraphHelper.CreateNode <OffsetTransformNode>(animationGraphSystem, "OffsetNode");
                state.SubtractClipNode = AnimationGraphHelper.CreateNode <ClipNode>(animationGraphSystem, "SubtractClipNode");
                state.DeltaNode        = AnimationGraphHelper.CreateNode <DeltaNode>(animationGraphSystem, "DeltaNode");

                nodeSet.Connect(state.ClipNode, ClipNode.KernelPorts.Output, state.DeltaNode, DeltaNode.KernelPorts.Input);
                nodeSet.Connect(state.SubtractClipNode, ClipNode.KernelPorts.Output, state.DeltaNode, DeltaNode.KernelPorts.Subtract);
                nodeSet.Connect(state.DeltaNode, DeltaNode.KernelPorts.Output, state.MixerNode, LayerMixerNode.KernelPorts.Input1);

                nodeSet.Connect(state.MixerNode, LayerMixerNode.KernelPorts.Output, state.OffsetNode, OffsetTransformNode.KernelPorts.Input);

                nodeSet.SendMessage(state.MixerNode, LayerMixerNode.SimulationPorts.BlendModeInput0, BlendingMode.Override);
                nodeSet.SendMessage(state.MixerNode, LayerMixerNode.SimulationPorts.WeightInput0, 1f);

                nodeSet.SendMessage(state.MixerNode, LayerMixerNode.SimulationPorts.BlendModeInput1, BlendingMode.Additive);
                nodeSet.SendMessage(state.MixerNode, LayerMixerNode.SimulationPorts.WeightInput1, 1f);

                // Expose input and outputs
                animSource.inputNode    = state.MixerNode;
                animSource.inputPortID  = (InputPortID)LayerMixerNode.KernelPorts.Input0;
                animSource.outputNode   = state.OffsetNode;
                animSource.outputPortID = (OutputPortID)OffsetTransformNode.KernelPorts.Output;

                commands.AddComponent(entity, state);
            }).Run();

            Entities
            .WithoutBurst()     // Can be removed once NodeSets are Burst-friendly
            .WithNone <Settings>()
            .ForEach((Entity entity, ref SystemState state) =>
            {
                Deinitialize(World, commands, entity, animationGraphSystem, state);
            }).Run();

            commands.Playback(EntityManager);
            commands.Dispose();

            return(default);
Beispiel #28
0
    public void LoadLevel(string levelname)
    {
        if (!Game.game.levelManager.CanLoadLevel(levelname))
        {
            GameDebug.Log("ERROR : Cannot load level : " + levelname);
            return;
        }

        Game.game.levelManager.LoadLevel(levelname);
    }
 private static void Update()
 {
     if (saveAssets)
     {
         saveAssets = false;
         GameDebug.Log("BundledResourceBuilder saving assets...");
         AssetDatabase.SaveAssets();
         GameDebug.Log("BundledResourceBuilder saving done");
     }
 }
Beispiel #30
0
    public virtual void OnConnectedToMaster()
    {
        GameDebug.Log("Connected to master");

        //this is for starting game directly , not through lobby->room
        if (!PhotonNetwork.InRoom)
        {
            PhotonNetwork.JoinOrCreateRoom(NetworkConfig.TestRoomName.Value, new RoomOptions(), TypedLobby.Default);
        }
    }