Ejemplo n.º 1
0
        //-------------------------------------------------------------------------
        // 好友通知
        void s2cPlayerFriendNotify(PlayerFriendNotify playerfriend_notify)
        {
            switch (playerfriend_notify.id)
            {
            case PlayerFriendNotifyId.RecommendPlayerList:    // 推荐好友列表
            {
                //EbLog.Note("ClientPlayerFriend.s2cPlayerFriendNotify() RecommendPlayerList");

                var list_recommend = EbTool.protobufDeserialize <List <PlayerInfo> >(playerfriend_notify.data);

                var e = EntityMgr.getDefaultEventPublisher().genEvent <EvEntityRecommendPlayerList>();
                e.list_recommend = list_recommend;
                e.send(null);
            }
            break;

            case PlayerFriendNotifyId.AddFriend:    // 通知添加好友
            {
                EbLog.Note("ClientPlayerFriend.s2cPlayerFriendNotify() AddFriend");

                var friend_item = EbTool.protobufDeserialize <PlayerInfo>(playerfriend_notify.data);

                Dictionary <string, PlayerInfo> map_friend = Def.mPropMapFriend.get();
                map_friend[friend_item.player_etguid] = friend_item;

                var e = EntityMgr.getDefaultEventPublisher().genEvent <EvEntityNotifyAddFriend>();
                e.friend_item = friend_item;
                e.send(null);
            }
            break;

            case PlayerFriendNotifyId.DeleteFriend:    // 通知删除好友
            {
                EbLog.Note("ClientPlayerFriend.s2cPlayerFriendNotify() DeleteFriend");

                var friend_etguid = EbTool.protobufDeserialize <string>(playerfriend_notify.data);

                PlayerInfo friend = null;
                Dictionary <string, PlayerInfo> map_friend = Def.mPropMapFriend.get();
                if (map_friend.TryGetValue(friend_etguid, out friend))
                {
                    map_friend.Remove(friend_etguid);
                }

                var e = EntityMgr.getDefaultEventPublisher().genEvent <EvEntityNotifyDeleteFriend>();
                e.friend_etguid = friend_etguid;
                e.send(null);
            }
            break;

            default:
                break;
            }
        }
        private async void SaveSolution_Clicked(object sender, EventArgs e)
        {
            string surl = SolutionName.Text?.Trim();

            if (string.IsNullOrEmpty(surl))
            {
                return;
            }

            try
            {
                if (!Utils.HasInternet)
                {
                    Utils.Alert_NoInternet();
                    return;
                }

                string domain = App.Settings.Vendor.GetDomain();

                if (surl.Split(CharConstants.DOT).Length == 1)
                {
                    surl += $".{domain}";
                }

                if (viewModel.IsSolutionExist(surl))
                {
                    await viewModel.RedirectToExistingSolution(surl, isMasterPage);

                    return;
                }

                EbLayout.ShowLoader();

                response = await viewModel.Validate(surl);

                if (response.IsValid)
                {
                    EbLayout.HideLoader();
                    SolutionLogoPrompt.Source = ImageSource.FromStream(() => new MemoryStream(response.Logo));
                    SolutionLabel.Text        = surl.Split(CharConstants.DOT)[0];
                    ShowSIDConfirmBox();
                    SoluUrl = surl;
                }
                else
                {
                    EbLayout.HideLoader();
                    Utils.Toast("Invalid solution URL");
                }
            }
            catch (Exception ex)
            {
                EbLog.Error(ex.Message);
            }
        }
Ejemplo n.º 3
0
        //-------------------------------------------------------------------------
        void _onSocketError(object rec, SocketErrorEventArgs args)
        {
            EbLog.Note("ClientNetMonitor._onSocketError()");

            //FloatMsgInfo f_info;
            //f_info.msg = "连接已断开!";
            //f_info.color = Color.red;
            //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);

            _onSocketClose();
        }
Ejemplo n.º 4
0
 //---------------------------------------------------------------------
 public void update(float elapsed_tm)
 {
     try
     {
         mEntityMgr.update(elapsed_tm);
     }
     catch (Exception ec)
     {
         EbLog.Error("EcEngine.update() Exception: " + ec);
     }
 }
Ejemplo n.º 5
0
    //-------------------------------------------------------------------------
    void _onSocketConnected(object client, EventArgs args)
    {
        EbLog.Note("ClientSampleNetwork._onSocketConnected()");

        //rpc(MethodType.c2sAccountRequest, account_request);

        DefaultRpcSession.rpc(999);

        //byte[] data = Encoding.UTF8.GetBytes("Hello world");
        //if (session != null) session.send(method_id, data);
    }
Ejemplo n.º 6
0
    //---------------------------------------------------------------------
    public override void init()
    {
        EbLog.Note("EsApp.init() entity_rpcid=" + Entity.getEntityRpcId());

        defRpcMethod((byte)_eNodeType.Ec, (ushort)_eMethodType.ec2esLogin, ec2esLogin);

        //EntityMgr.defRpcMethod((byte)_eNodeType.Ec, (ushort)_eMethodType.nodeEc2EsLogin, nodeEc2EsLogin);

        EnableUpdate = true;
        Def.mPropNickName.set("test_nickname");
    }
Ejemplo n.º 7
0
        //-------------------------------------------------------------------------
        public void freeStillSprite(StillSprite still_sprite)
        {
#if UNITY_EDITOR
            if (still_sprite != null && still_sprite.GetType().ToString() == "FishStillSprite")
            {
                EbLog.Error("freeStillSprite::error");
            }
#endif

            mStillSpritePool.freeStillSprite(still_sprite);
        }
Ejemplo n.º 8
0
    //-------------------------------------------------------------------------
    public async Task <MethodData> c2sPlayerLobbyRequest(MethodData method_data)
    {
        MethodData result = new MethodData();

        result.method_id = MethodType.None;

        var lobby_request = EbTool.protobufDeserialize <PlayerLobbyRequest>(method_data.param1);

        switch (lobby_request.id)
        {
        case PlayerLobbyRequestId.SearchDesktop:    // 搜索桌子
        {
            EbLog.Note("CellPlayerLobby.c2sPlayerLobbyRequest() SearchDesktop");

            var search_filter = EbTool.protobufDeserialize <DesktopSearchFilter>(lobby_request.data);

            var grain = Entity.getUserData <GrainCellPlayer>();
            var grain_desktopservice = grain.GF.GetGrain <ICellDesktopService>(0);
            var list_desktop_info    = await grain_desktopservice.searchDesktop(search_filter);

            PlayerLobbyResponse lobby_response;
            lobby_response.id   = PlayerLobbyResponseId.SearchDesktop;
            lobby_response.data = EbTool.protobufSerialize <List <DesktopInfo> >(list_desktop_info);

            result.method_id = MethodType.s2cPlayerLobbyResponse;
            result.param1    = EbTool.protobufSerialize <PlayerLobbyResponse>(lobby_response);
        }
        break;

        case PlayerLobbyRequestId.SearchDesktopFollowFriend:    // 搜索好友所在的牌桌
        {
            EbLog.Note("CellPlayerLobby.c2sPlayerLobbyRequest() SearchDesktopFollowFriend");

            var desktop_etguid = EbTool.protobufDeserialize <string>(lobby_request.data);

            var grain = Entity.getUserData <GrainCellPlayer>();
            var grain_desktopservice = grain.GF.GetGrain <ICellDesktopService>(0);
            var list_desktop_info    = await grain_desktopservice.searchDesktopFollowFriend(desktop_etguid);

            PlayerLobbyResponse lobby_response;
            lobby_response.id   = PlayerLobbyResponseId.SearchDesktopFollowFriend;
            lobby_response.data = EbTool.protobufSerialize <List <DesktopInfo> >(list_desktop_info);

            result.method_id = MethodType.s2cPlayerLobbyResponse;
            result.param1    = EbTool.protobufSerialize <PlayerLobbyResponse>(lobby_response);
        }
        break;

        default:
            break;
        }

        return(result);
    }
 private void DropTable(string tableName)
 {
     try
     {
         App.DataDB.DoNonQuery($"DROP TABLE IF EXISTS {tableName};");
     }
     catch (Exception ex)
     {
         EbLog.Error($"Failed to drop Table {tableName} : " + ex.Message);
     }
 }
Ejemplo n.º 10
0
        //-------------------------------------------------------------------------
        public void playBackgroundSound(string snd_name, bool is_loop = false)
        {
            if (string.IsNullOrEmpty(snd_name))
            {
                EbLog.Note("ClientSound.playBackgroundSound() 声音名称为空");
            }

            string    full_snd_name = "Audio/" + snd_name;
            AudioClip audio_clip    = (AudioClip)Resources.Load(full_snd_name, typeof(AudioClip));
            //SoundManager.Play(audio_clip, is_loop);
        }
Ejemplo n.º 11
0
    //---------------------------------------------------------------------
    public void onPlayerActionWaitingTimeEnd(string player_etguid)
    {
        SeatInfo seat_cur = getSeat(player_etguid);

        if (seat_cur == null)
        {
            return;
        }

        EbLog.Note("CellDesktop.onPlayerActionWaitingTimeEnd() PlayerEtGuid=" + player_etguid);
    }
Ejemplo n.º 12
0
        //-------------------------------------------------------------------------
        // 请求交付任务
        public void requestFinishTask(int task_id)
        {
            EbLog.Note("ClientPlayerTask.requestFinishTask() TaskId=" + task_id);

            PlayerTaskRequest playertask_request;

            playertask_request.id   = PlayerTaskRequestId.TaskFinish;
            playertask_request.data = EbTool.protobufSerialize <int>(task_id);

            DefaultRpcSession.rpc((ushort)MethodType.c2sPlayerTaskRequest, playertask_request);
        }
Ejemplo n.º 13
0
        //---------------------------------------------------------------------
        internal EbTable _getTable(string table_name)
        {
            EbTable table;

            mMapTable.TryGetValue(table_name, out table);
            if (table == null)
            {
                EbLog.Error("EbDb.getTable() Error! not exist table,table_name=" + table_name);
            }
            return(table);
        }
Ejemplo n.º 14
0
    //-------------------------------------------------------------------------
    public override void init()
    {
        EbLog.Note("ClientUCenterSession.init()");

        defRpcMethod((byte)_eUCenterNodeType.UCenter, (ushort)_eUCenterMethodType.login2ClientOnLogin, login2ClientOnLogin);

        // 设置session
        RpcSession session = (RpcSession)Entity.getCacheData("RemoteSession");

        Entity.setSession((byte)_eUCenterNodeType.UCenter, session);
    }
Ejemplo n.º 15
0
        //---------------------------------------------------------------------
        public byte[] GetTableAsBytes(string table_name)
        {
            EbTableBuffer table = null;

            mMapTable.TryGetValue(table_name, out table);
            if (table == null)
            {
                EbLog.Error("EbDb.getTable() Error! not exist table,table_name=" + table_name);
            }
            return(table.GetTableData());
        }
Ejemplo n.º 16
0
        //---------------------------------------------------------------------
        public EbPropSet getPropSet(int id)
        {
            EbPropSet prop_set;

            mMapPropSet.TryGetValue(id, out prop_set);
            if (prop_set == null)
            {
                EbLog.Error("EbTable.getPropSet() Error! not exist prop_set,id=" + id);
            }
            return(prop_set);
        }
Ejemplo n.º 17
0
        //---------------------------------------------------------------------
        public EntityDef getEntityDef(string entity_type)
        {
            EntityDef entity_def = null;

            mMapEntityDef.TryGetValue(entity_type, out entity_def);
            if (entity_def == null)
            {
                EbLog.Error("EntityMgr.getEntityDef() Error! 不存在entity_type=" + entity_type);
            }
            return(entity_def);
        }
 public void UpdateDraftAsSynced(int id, int draftId)
 {
     try
     {
         App.DataDB.DoNonQuery($"UPDATE {this.TableName} SET eb_synced = {(int)DataSyncStatus.Synced} WHERE id = {id} AND eb_syncrecord_id = {draftId} AND eb_synced = {(int)DataSyncStatus.Error}");
     }
     catch (Exception ex)
     {
         EbLog.Error("UpdateDraftAsSynced: " + ex.Message);
     }
 }
Ejemplo n.º 19
0
        //---------------------------------------------------------------------
        /// <summary>
        /// This will prepare a certain query where stmHandle is pointing or handling
        /// </summary>
        private IntPtr Prepare(string query)
        {
            IntPtr stmHandle;

            if (sqlite3_prepare_v2(connection, query, -1, out stmHandle, IntPtr.Zero) != SQLITE_OK)
            {
                IntPtr errorMsg = sqlite3_errmsg(connection);
                EbLog.Note(Marshal.PtrToStringAnsi(errorMsg) + ":" + query);
            }

            return(stmHandle);
        }
Ejemplo n.º 20
0
 public static bool EvaluateHideExpr(string script)
 {
     try
     {
         return(Instance.evaluator.Execute <bool>(script));
     }
     catch (Exception ex)
     {
         EbLog.Error("list hide expr failure, " + ex.Message);
         return(false);
     }
 }
Ejemplo n.º 21
0
    //-------------------------------------------------------------------------

    //-------------------------------------------------------------------------
    public override void init()
    {
        EbLog.Note("ClientSampleApp.init()");

        EntityMgr.getDefaultEventPublisher().addHandler(Entity);

        // AutoPatcher示例
        //EntityMgr.createEntity<EtSampleAutoPatcher>(null, Entity);

        // Network示例
        EntityMgr.createEntity <EtSampleNetwork>(null, Entity);
    }
    //-------------------------------------------------------------------------
    public void launchAutoPatcher(AutoPatcherConfig cfg)
    {
        // 设置自动更新参数配置,并检查参数有效性
        AutoPatcherConfig.RemoteVersionInfoUrl = cfg.RemoteVersionInfoUrl;
        if (string.IsNullOrEmpty(AutoPatcherConfig.RemoteVersionInfoUrl))
        {
            EbLog.Error("ClientAutoPatcher.launchAutoPatcher() AutoPatcherConfig.ServerUrlPrefix is Null!");
        }

        // 启动自动更新
        StepGetRemoteVersionInfo = true;
    }
Ejemplo n.º 23
0
 private void ClearLog_Clicked(object sender, EventArgs e)
 {
     try
     {
         File.WriteAllText($"{nativeHelper.NativeRoot}/{logPath}", string.Empty);
         Utils.Toast("Log file cleared :)");
     }
     catch (Exception ex)
     {
         EbLog.Error("Failed to clear logs, " + ex.Message);
     }
 }
Ejemplo n.º 24
0
    //-------------------------------------------------------------------------
    // Print usage info to console window, showing cmd-line params for OrleansHost.exe
    public void PrintUsage()
    {
        EbLog.Note(
            @"USAGE: 
    OrleansHost.exe [<siloName> [<configFile>]] [DeploymentId=<idString>] [/debug]
Where:
    <siloName>      - Name of this silo in the Config file list (optional)
    <configFile>    - Path to the Config file to use (optional)
    DeploymentId=<idString> 
                    - Which deployment group this host instance should run in (optional)
    /debug          - Turn on extra debug output during host startup (optional)");
    }
Ejemplo n.º 25
0
 private void OpenSettings()
 {
     try
     {
         ILocationHelper locService = DependencyService.Get <ILocationHelper>();
         locService.OpenSettings();
     }
     catch (Exception ex)
     {
         EbLog.Error("failed to open location settings in [GoogleMap] view, " + ex.Message);
     }
 }
Ejemplo n.º 26
0
    //-------------------------------------------------------------------------
    public override void init()
    {
        EbLog.Note("ClientNode.init()");

        var settings = EcEngine.Instance.Settings;

        if (settings.EnableCoSuperSocket)
        {
            var et = EntityMgr.createEntity <EtSuperSocket>(null, Entity);
            CoSuperSocket = et.getComponent <ClientSuperSocket <DefSuperSocket> >();
        }
    }
Ejemplo n.º 27
0
 public static void EvaluateValueExpr(View view, string script)
 {
     try
     {
         Instance.context.SetCurrentView(view);
         Instance.evaluator.Execute(script);
     }
     catch (Exception ex)
     {
         EbLog.Error("list hide expr failure, " + ex.Message);
     }
 }
Ejemplo n.º 28
0
 //---------------------------------------------------------------------
 public EntityAffectorData buildAffectorData(JsonItem json_item)
 {
     if (mDicAffectorFactory.ContainsKey(json_item.mTypeName))
     {
         return(mDicAffectorFactory[json_item.mTypeName].buildAffectorData(json_item));
     }
     else
     {
         EbLog.Error(@"BaseFishLordMgr::buildAffectorData::error::there are no " + json_item.mTypeName + " factory");
         return(null);
     }
 }
Ejemplo n.º 29
0
    //-------------------------------------------------------------------------
    async void c2sPlayerRequest(PlayerRequest player_request)
    {
        IRpcSession s           = EntityMgr.LastRpcSession;
        ClientInfo  client_info = CoApp.getClientInfo(s);

        if (client_info == null)
        {
            return;
        }

        Task <MethodData> task = await Task.Factory.StartNew <Task <MethodData> >(async() =>
        {
            MethodData method_data = new MethodData();
            method_data.method_id  = MethodType.c2sPlayerRequest;
            method_data.param1     = EbTool.protobufSerialize <PlayerRequest>(player_request);

            MethodData r = null;
            try
            {
                var grain_playerproxy = GrainClient.GrainFactory.GetGrain <ICellPlayer>(new Guid(client_info.et_player_guid));
                r = await grain_playerproxy.c2sRequest(method_data);
            }
            catch (Exception ex)
            {
                EbLog.Error(ex.ToString());
            }

            return(r);
        });

        if (task.Status == TaskStatus.Faulted || task.Result == null)
        {
            if (task.Exception != null)
            {
                EbLog.Error(task.Exception.ToString());
            }

            return;
        }

        MethodData result = task.Result;

        if (result.method_id == MethodType.None)
        {
            return;
        }

        lock (CoApp.RpcLock)
        {
            var player_response = EbTool.protobufDeserialize <PlayerResponse>(result.param1);
            CoApp.rpcBySession(s, (ushort)MethodType.s2cPlayerResponse, player_response);
        }
    }
Ejemplo n.º 30
0
 private void Render()
 {
     try
     {
         FormViewContainer.Children.Clear();
         EbFormHelper.AddAllControlViews(FormViewContainer, Controls, FormMode, NetWorkType, Context, "form", false);
     }
     catch (Exception ex)
     {
         EbLog.Error(ex.Message);
     }
 }