Beispiel #1
0
        public static void ConfirmFriend(int uid, int mid)
        {
            int ret = UserData.BeingFriend(uid, mid, 2);

            if (ret > 0) // build event
            {
                string suid = uid.ToString();
                string smid = mid.ToString();
                /// uid be friend with mid
                IDictionary <string, string> data = new Dictionary <string, string>();
                data.Add("name", smid);
                data.Add("www", smid);
                data.Add("name_self", suid);
                data.Add("www_self", suid);
                data.Add("icon", suid);
                EventData.CreateEvent(EventType.Normal, EventSpreadType.Specified, uid, uid, "be_friend", JU.Array(data));

                // mid be friend with uid
                IDictionary <string, string> datam = new Dictionary <string, string>();
                datam.Add("name", suid);
                datam.Add("www", suid);
                datam.Add("name_self", smid);
                datam.Add("www_self", smid);
                datam.Add("icon", smid);
                EventData.CreateEvent(EventType.Normal, EventSpreadType.Specified, mid, mid, "be_friend", JU.Array(datam));
            }
        }
Beispiel #2
0
    //死亡
    public override void Die()
    {
        actionManager.Destory();

        //InGameManager.GetInstance().inGameUIManager.DelRole(this.instanceId);
        //base.Die();
        SetAnimatorState(AnimatorState.Dead, 1);

        if (camp == enMSCamp.en_camp_enemy)
        {
            if (killMe.GetObjType() == enObjType.character)
            {
                //爆装备
                InGameBaseCharacter source = (InGameBaseCharacter)killMe;
                if (UnityEngine.Random.Range(0, 100) < conf.outodds)
                {
                    EquipSystem.GetInstance().OutEquip(gameObject, level,
                                                       source.propertys.GetProperty(enCharacterProperty.equipdrop) +
                                                       this.conf.equipdrop);
                }
                EventData.CreateEvent(EventID.EVENT_DATA_KILLENEMY).AddData(source, this).Send();
            }
        }

        transform.GetComponent <BoxCollider>().enabled    = false;
        transform.GetComponent <SphereCollider>().enabled = false;
        Invoke("Delself", 3);
    }
Beispiel #3
0
    //----level exp----
    public void AddExp(int roleid, int count)
    {
        RoleData data = GetRoleData(roleid);
        int      exp  = data.exp + count;

        data.exp = exp;
        if (!ConfigManager.levelExpManager.dataMap.ContainsKey(data.level))
        {
            return;
        }
        LevelExp leveldata = ConfigManager.levelExpManager.dataMap[data.level];

        while (leveldata.exp <= exp)
        {
            exp     -= leveldata.exp;
            data.exp = exp;
            data.level++;
            data.levelupPoint++;
            if (!ConfigManager.levelExpManager.dataMap.ContainsKey(data.level))
            {
                break;
            }
            leveldata = ConfigManager.levelExpManager.dataMap[data.level];

            EventData.CreateEvent(EventID.EVENT_GAME_ROLR_LEVELUP).AddData(data).Send();
        }

        SaveData(userDataRole);

        EventData.CreateEvent(EventID.EVENT_DATA_CHANGEEXP).AddData(data).Send();
    }
Beispiel #4
0
 public static void LoadData()
 {
     Debuger.Log("===========启动配置表管理器===========");
     confEffectManager.Load();
     Debuger.Log("----------配置表管理器启动成功-----------");
     EventData.CreateEvent(EventID.EVENT_CONFIG_LOADFINISHED).Send();
 }
Beispiel #5
0
    public override void Init(int instanceId, int confid, enMSCamp camp)
    {
        base.Init(instanceId, confid, camp);

        propertys = new CharacterProperty();

        conf = ConfigManager.characterConfManager.dic[confid];

        //名字
        charactername = conf.name;

        //AI管理器
        actionManager = new BaseActionManager();
        actionManager.Init(this, Vector3.zero);

        //动画管理器
        anim = this.GetComponent <Animator>();

        //血条高度
        boxSize = transform.GetComponent <BoxCollider>().size *transform.localScale.x;

        //注册到UI界面
        //InGameManager.GetInstance().inGameUIManager.AddRole(this);

        this.level = conf.level;
        ResetAllProperty(true);

        lastPos = transform.position;

        EventManager.Register(this,
                              EventID.EVENT_GAME_CHARACTER_HURT);


        EventData.CreateEvent(EventID.EVENT_GAME_CHARACTER_BORN).AddData(this).Send();
    }
Beispiel #6
0
        public async Task SubjectActionAndArrayKey()
        {
            var id = Guid.NewGuid();
            var no = 123;

            var ed = EventData.CreateEvent("Subject", "Action", id, no);
            var eh = await new EventHubs.AzureEventHubsEventConverter {
                UseMessagingPropertiesForMetadata = true
            }.ConvertToAsync(ed);

            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", eh.Properties[EventMetadata.SubjectAttributeName]);
            Assert.AreEqual("Action", eh.Properties[EventMetadata.ActionAttributeName]);
            Assert.IsFalse(eh.Properties.ContainsKey(EventMetadata.TenantIdAttributeName));
            Assert.AreEqual(id, ((object[])eh.Properties[EventMetadata.KeyPropertyName])[0]);
            Assert.AreEqual(no, ((object[])eh.Properties[EventMetadata.KeyPropertyName])[1]);

            ed = await new EventHubs.AzureEventHubsEventConverter {
                UseMessagingPropertiesForMetadata = true
            }.ConvertFromAsync(eh);
            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", ed.Subject);
            Assert.AreEqual("Action", ed.Action);
            Assert.AreEqual(null, ed.TenantId);
            Assert.AreEqual(id, ((object[])ed.Key)[0]);
            Assert.AreEqual(no, ((object[])ed.Key)[1]);
        }
Beispiel #7
0
 private void Receive(EventData <Package> msg)
 {
     //Debug.Log(msg.args[0].type);
     foreach (var item in msg.args)
     {
         //Debug.Log((MessageType)item.type);
         EventData <Package> .CreateEvent((MessageType)item.type, item).Send();
     }
 }
Beispiel #8
0
    public void CancelEquip(int unequipinstanceid){

        UserDataManager.instance.CancelEquip(unequipinstanceid);

        role.CancleEquip(unequipinstanceid);
        role.ResetAllProperty();

        EventData.CreateEvent(EventID.EVENT_UI_REFRESH_PACKAGEUI).Send();
    }
Beispiel #9
0
    // Use this for initialization
    void Start()
    {
        flushTime    = 99999;
        intervalTime = flushTime;

        EventData.CreateEvent(EventID.EVENT_ADD_ENEMYPOINT).AddData(this).Send();

        this.gameObject.SetActive(false);
    }
Beispiel #10
0
 void Click(GameObject go)
 {
     if (edata == null)
     {
         return;
     }
     //InGameManager.GetInstance().inGamePlayerManager.ChangerWeapon(econf);
     //EquipInfoLayer.Create(edata);
     EventData.CreateEvent(EventID.EVENT_UI_PACKAGE_SELECT_ITEM).AddData(edata).Send();
 }
Beispiel #11
0
    private void Update()
    {
        if (Input.GetKeyUp(KeyCode.Space))
        {
            Package package = new Package(0, "test");
            EventData <Package> .CreateEvent(PackageDir.send, package).Send();

            Package package1 = new Package((int)MessageType.Test2, "哈哈哈啊哈哈哈哈哈哈啊哈哈哈哈哈哈啊哈哈哈哈哈");
            EventData <Package> .CreateEvent(PackageDir.send, package1).Send();
        }
    }
 public static void LoadData()
 {
     Debuger.Log("===========启动配置表管理器===========");
     tankListManager.Load();
     weaponListManager.Load();
     skillListManager.Load();
     itemListManager.Load();
     normalLevelManager.Load();
     confEffectManager.Load();
     Debuger.Log("----------配置表管理器启动成功-----------");
     EventData.CreateEvent(EventID.EVENT_CONFIG_LOADFINISHED).Send();
 }
Beispiel #13
0
        public GameManager()
        {
            // 未登录初始名字是 Login
            user = new GameUserInfoDTO {
                username = "******"
            };
            mapInfos = new List <GameMapInfoDTO>();
            mapCache = new Dictionary <string, string>();
            imgCache = new Dictionary <string, Sprite>();

            loginSucceedEvent = EventData.CreateEvent(EventID.LoginSucceed);
        }
Beispiel #14
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 150, 50), "send eve1"))
        {
            Event1 eve = new Event1(1, 2, "123");
            eve.Send();
        }

        if (GUI.Button(new Rect(10, 70, 150, 50), "send eve2"))
        {
            EventData.CreateEvent(EventID.EVENT_2).Send();
        }
    }
Beispiel #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="user"></param>
        /// <param name="uid"></param>
        /// <returns></returns>
        public static int ApplyFriend(int uid, int tid)
        {
            bool noApply = UserData.CanApplyFriend(uid, tid);

            if (noApply)
            {
                IDictionary <string, string> data = new Dictionary <string, string>();
                string sid = uid.ToString();
                data.Add("name", sid);
                data.Add("www", sid);
                data.Add("uid", sid);
                data.Add("tid", tid.ToString());
                return(EventData.CreateEvent(EventType.Important, EventSpreadType.Specified, tid, uid, "apply_friend", JU.Array(data)));
            }
            return(0);
        }
Beispiel #16
0
        public void SubjectAndAction()
        {
            var ed = EventData.CreateEvent("Subject", "Action");
            var eh = ed.ToEventHubsEventData();

            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", eh.Properties[EventDataMapper.SubjectPropertyName]);
            Assert.AreEqual("Action", eh.Properties[EventDataMapper.ActionPropertyName]);
            Assert.AreEqual(null, eh.Properties[EventDataMapper.TenantIdPropertyName]);
            Assert.AreEqual(null, eh.Properties[EventDataMapper.KeyPropertyName]);

            ed = eh.ToBeefEventData();
            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", ed.Subject);
            Assert.AreEqual("Action", ed.Action);
            Assert.AreEqual(null, ed.TenantId);
            Assert.AreEqual(null, ed.Key);
        }
Beispiel #17
0
    public void NextDay()
    {
        UnitData.Instance.NextDay();
        //이벤트 재생성
        event_.CreateEvent();

        //다음 시간.
        player.NextDay();

        //해당 데이터 저장
        //data.SaveOverlapXml();
        data.SaveXml();
        world.DungeonUpdate();

        //이벤트 체크 후 세이브창 표시
        EventCheck();

        nextDay.Play();
    }
Beispiel #18
0
    /// <summary>
    /// Hurt the specified source, val, comborate, comboval and strike.
    /// </summary>
    /// <returns>The hurt.</returns>
    /// <param name="source">Source.</param>
    /// <param name="val">Value.</param>
    /// <param name="comborate">Comborate.</param>
    /// <param name="comboval">Comboval.</param>
    /// <param name="strike">是否穿透攻击.</param>
    public bool Hurt(InGameBaseObj source, int val, float comborate, float comboval, bool strike)
    {
        float overval = val;


        if (UnityEngine.Random.Range(0f, 100f) < propertys.GetProperty(enCharacterProperty.avoid))
        {
            ChangeLifeLabel.CreateChangeLifeLabel(transform.position +
                                                  new Vector3(0, this.boxSize.y + 0.2f, 0), Color.yellow, "闪避");
            return(false);
        }

        bool iscombo = false;

        if (UnityEngine.Random.Range(0f, 100f) < comborate)
        {
            overval += overval * comboval / 100f;
            iscombo  = true;
        }

        if (!strike)
        {
            float armor = propertys.GetProperty(enCharacterProperty.armor) * 0.06f;
            armor    = (armor / (armor + 1));
            overval -= overval * armor;
            if (overval < 0)
            {
                overval = 0;
            }
        }

        float returnval = overval * (propertys.GetProperty(enCharacterProperty.returnhurt) / 100f);

        overval -= returnval;

        ((InGameBaseCharacter)source).ChangeLife(this, -(int)returnval, false);
        ((InGameBaseCharacter)source).AtkHurt(source, (int)overval);

        EventData.CreateEvent(EventID.EVENT_GAME_CHARACTER_HURT).
        AddData(source, this, -(int)overval).Send();

        return(ChangeLife(source, -(int)Math.Ceiling(overval), iscombo));
    }
Beispiel #19
0
    public override void HandleEvent(EventData resp)
    {
        if (role.IsDie()) return;
        switch (resp.eid)
        {
            case EventID.EVENT_GAME_TOUCH_GROUND:
                EventGameTouchGround eve = (EventGameTouchGround)resp;

                role.StartRun(eve.pos);
                break;
            case EventID.EVENT_GAME_TOUCH_OBJ:
                EventData touchobje = (EventData)resp;
                InGameBaseObj obj = (InGameBaseObj) touchobje.sUserData[0];

                if (obj.instanceId != role.instanceId && !obj.IsDie())
                {
                    role.StartAtk(obj);
                }

                break;
            case EventID.EVENT_UI_EQUIP:
                int instanceid = int.Parse(resp.sUserData[0].ToString());
                AddEquip(instanceid);
                EventData.CreateEvent(EventID.EVENT_UI_REFRESH_PACKAGEUI).Send();
                break;
            case EventID.EVENT_UI_DELEQUIP:
                int delinstanceid = int.Parse(resp.sUserData[0].ToString());
                UserDataManager.instance.DelEquip(delinstanceid);
                EventData.CreateEvent(EventID.EVENT_UI_REFRESH_PACKAGEUI).Send();
                break;

            case EventID.EVENT_UI_UNEQUIP:
                int unequipinstanceid = int.Parse(resp.sUserData[0].ToString());
                CancelEquip(unequipinstanceid);
                break;

            case EventID.EVENT_DATA_REFRESHPROPERTY:
                role.ResetAllProperty();
                break;
        }

    }
Beispiel #20
0
        /// <summary>
        /// 接受数据
        /// </summary>
        /// <param name="socket"></param>
        private void OnReceiveData(Socket socket)
        {
            byte[] tempArr = new byte[receLen];
            Array.Copy(buffer, tempArr, receLen);
            receiveDataList.AddRange(tempArr);
            if (receiveDataList.Count >= 4)
            {
                byte[] dataArray = receiveDataList.GetRange(0, 4).ToArray();
                //int len = BitConverter.ToInt32(dataArray, 0);
                int len = NetworkUtils.ByteArray2Int(dataArray, 0);
                //Debug.Log("receiveDataList: " + receiveDataList.Count+"  == ?"+len);
                if (receiveDataList.Count >= len)
                {
                    Package package = new Package();
                    package.UnPack(receiveDataList.ToArray());

                    EventData <Package> .CreateEvent(PackageDir.receive, package).Send();
                }
            }
        }
Beispiel #21
0
    public void InitSprite()
    {
        textureWidth  = mapSizeX * unitSize;
        textureHeight = mapSizeY * unitSize;

        mapTexture            = new Texture2D(textureWidth, textureHeight);
        mapTexture.filterMode = FilterMode.Point;
        for (int w = 0; w < textureWidth; w++)
        {
            for (int h = 0; h < textureHeight; h++)
            {
                mapTexture.SetPixel(w, h, mapColors[(int)MazeCreate.PointType.non]);
            }
        }
        mapTexture.Apply();

        ApplySprite();

        EventData.CreateEvent(EventID.EVENT_UI_INITMAPTEXTURE).AddData(mapTexture).Send();
    }
Beispiel #22
0
    public void AddProperty(int roleid, int propertyid, int count)
    {
        RoleData data = GetRoleData(roleid);

        float val = count;

        if (data.additionPropertyList.ContainsKey(propertyid))
        {
            data.additionPropertyList[propertyid] += val;
        }
        else
        {
            data.additionPropertyList.Add(propertyid, val);
        }

        SaveData(userDataRole);

        Debug.Log("AddProperty");
        EventData.CreateEvent(EventID.EVENT_DATA_REFRESHPROPERTY).Send();
    }
Beispiel #23
0
        /// <summary>
        /// 接受消息回调
        /// </summary>
        /// <param name="ar"></param>
        private void ReadCallBack(IAsyncResult ar)
        {
            NetworkStream stream;

            try
            {
                stream = (NetworkStream)ar.AsyncState;
                stream.EndRead(ar);
                byte[] sizeData = new byte[4];
                stream.Read(sizeData, 0, sizeData.Length);

                int    size = BitConverter.ToInt32(sizeData, 0);
                byte[] data = new byte[size];
                stream.Read(data, 0, data.Length);
                EventData <Package> .CreateEvent(PackageDir.receive, new Package().UnPack(data)).Send();
            }
            catch (IOException e)
            {
                Debug.Log("远程服务器关闭" + e.Message);
            }
        }
Beispiel #24
0
    //生命值变化
    public bool ChangeLife(InGameBaseObj source, int val, bool iscombo)
    {
        if (val == 0)
        {
            return(false);
        }
        float maxlife = propertys.GetProperty(enCharacterProperty.life);

        life = Mathf.Clamp(life + val, 0, maxlife);

        if (life <= 0)
        {
            SetDie(false);
            killMe = source;
            EventData.CreateEvent(EventID.EVENT_GAME_CHARACTER_DIE).AddData(this).Send();
        }
        Color c;

        if (val > 0)
        {
            c = Color.green;
        }
        else
        {
            if (iscombo)
            {
                c = Color.red;
            }
            else
            {
                c = Color.yellow;
            }
        }
        ChangeLifeLabel.CreateChangeLifeLabel(transform.position +
                                              new Vector3(0, this.boxSize.y + 0.2f, 0), c, val + "");

        EventData.CreateEvent(EventID.EVENT_DATA_CHANGELIFE).
        AddData(this).Send();
        return(true);
    }
Beispiel #25
0
    public override void Init()
    {
        base.Init();


        EventManager.Register(this,
                              EventID.EVENT_GAME_TOUCH_GROUND,
                              EventID.EVENT_GAME_TOUCH_OBJ,
                              EventID.EVENT_UI_EQUIP,
                              EventID.EVENT_UI_DELEQUIP,
                              EventID.EVENT_UI_UNEQUIP,
                              EventID.EVENT_DATA_REFRESHPROPERTY);


        RoleData rd = UserDataManager.instance.GetChooseRoleData();

        role = InGameManager.GetInstance().inGameObjManager.AddObj(rd.roldid,enMSCamp.en_camp_player) as InGameBaseCharacter;
        role.SetData(rd);

        //InGameManager.GetInstance().GetManager<InGameObjManager>(InGameManager.enGameManager.InGameObjManager).AddObj(0);
        Vector3 startpos = InGameManager.GetInstance().inGameLevelManager.gameMap.GetStartPosition();

        role.transform.position = GameCommon.GetWorldPos(startpos);
        role.SetZPos();

        InGameManager.GetInstance().inGameCameraManager.SetTarget(role.gameObject);

        for (int i = 0; i < rd.choseEquipList.Count; i++)
        {
            if (rd.choseEquipList[i] == -1) continue;
            EquipData edata = UserDataManager.instance.GetEquip(rd.choseEquipList[i]);
            role.AddEquip(edata);
        }

        //UserDataManager.instance.AddLevelupPoint(role.GetData().instanceid,5);
        role.ResetAllProperty(true);
        EventData.CreateEvent(EventID.EVENT_GAME_INITROLE).AddData(role).Send();

    }
Beispiel #26
0
        public async Task SubjectAndAction()
        {
            var ed = EventData.CreateEvent("Subject", "Action");
            var eh = await new EventHubs.AzureEventHubsEventConverter {
                UseMessagingPropertiesForMetadata = true
            }.ConvertToAsync(ed);

            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", eh.Properties[EventMetadata.SubjectAttributeName]);
            Assert.AreEqual("Action", eh.Properties[EventMetadata.ActionAttributeName]);
            Assert.IsFalse(eh.Properties.ContainsKey(EventMetadata.TenantIdAttributeName));
            Assert.IsFalse(eh.Properties.ContainsKey(EventMetadata.KeyPropertyName));

            ed = await new EventHubs.AzureEventHubsEventConverter {
                UseMessagingPropertiesForMetadata = true
            }.ConvertFromAsync(eh);
            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", ed.Subject);
            Assert.AreEqual("Action", ed.Action);
            Assert.AreEqual(null, ed.TenantId);
            Assert.AreEqual(null, ed.Key);
        }
Beispiel #27
0
    void Send()
    {
        //int
        Package intPack = new Package((int)MessageType.Test1, 12);

        EventData <Package> .CreateEvent(PackageDir.send, intPack).Send();

        //小字节数组
        Package smallByteArrayPack = new Package((int)MessageType.Test2, new byte[10]);

        EventData <Package> .CreateEvent(PackageDir.send, smallByteArrayPack).Send();

        //大字节数组
        Package bigByteArrsyPack = new Package((int)MessageType.Test2, new byte[1024000]);

        EventData <Package> .CreateEvent(PackageDir.send, bigByteArrsyPack).Send();

        //字符串
        Package stringPack = new Package((int)MessageType.Test3, "test");

        EventData <Package> .CreateEvent(PackageDir.send, stringPack).Send();
    }
Beispiel #28
0
        public void SubjectActionAndArrayKey()
        {
            var id = Guid.NewGuid();
            var no = 123;

            var ed = EventData.CreateEvent("Subject", "Action", id, no);
            var eh = ed.ToEventHubsEventData();

            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", eh.Properties[EventDataMapper.SubjectPropertyName]);
            Assert.AreEqual("Action", eh.Properties[EventDataMapper.ActionPropertyName]);
            Assert.AreEqual(null, eh.Properties[EventDataMapper.TenantIdPropertyName]);
            Assert.AreEqual(id, ((object[])eh.Properties[EventDataMapper.KeyPropertyName])[0]);
            Assert.AreEqual(no, ((object[])eh.Properties[EventDataMapper.KeyPropertyName])[1]);

            ed = eh.ToBeefEventData();
            Assert.IsNotNull(eh);
            Assert.AreEqual("Subject", ed.Subject);
            Assert.AreEqual("Action", ed.Action);
            Assert.AreEqual(null, ed.TenantId);
            Assert.AreEqual(id, ((object[])ed.Key)[0]);
            Assert.AreEqual(no, ((object[])ed.Key)[1]);
        }
 public GameVictoryEffect()
 {
     harmEvent = EventData.CreateEvent(EventID.Win);
     EventManager.Register(this, EventID.ResetGame, EventID.ReturnMenu);
 }
Beispiel #30
0
    //捡装备
    public void AddEquip(EquipData ed){
        ed.roleid = -role.instanceId;
        UserDataManager.instance.AddEquip(ed);

        EventData.CreateEvent(EventID.EVENT_UI_REFRESH_PACKAGEUI).Send();
    }