Example #1
0
    public virtual void ChangeValue(st.net.NetBase.property _value)
    {
        ulong ulongVal = (ulong)_value.data;

        if (_value.sort == 1)
        {
            serverData.propertyValueDic[(ActorPropertyTag)_value.type] = _value.data;
            //Debug.Log("ActorPropertyTag:" + (ActorPropertyTag)_value.type + ",value:" + _value.data);
            if (OnPropertyUpdate != null)
            {
                OnPropertyUpdate((ActorPropertyTag)_value.type, _value.data, false);
            }
        }
        else if (_value.sort == 2)
        {
            serverData.baseValueDic[(ActorBaseTag)_value.type] = ulongVal;
            if (OnBaseUpdate != null)
            {
                OnBaseUpdate((ActorBaseTag)_value.type, ulongVal, false);
            }
            if ((ActorBaseTag)_value.type == ActorBaseTag.Camp)
            {
                SetCamp((int)_value.data);
            }
        }
    }
Example #2
0
    public override void ChangeValue(st.net.NetBase.property _value)
    {
        int diff = 0;
        //Debug.Log("_value.sort:"+_value.sort+",_value.type:"+_value.type+",_value.data:"+_value.data);
        ulong ulongVal = (ulong)_value.data;

        if (_value.sort == 1)
        {
            if (serverData.propertyValueDic.ContainsKey((ActorPropertyTag)_value.type))
            {
                diff = (int)(_value.data - serverData.propertyValueDic[(ActorPropertyTag)_value.type]);
            }
            serverData.propertyValueDic[(ActorPropertyTag)_value.type] = _value.data;
            if (OnPropertyDiffUpdate != null && diff != 0)
            {
                OnPropertyDiffUpdate((ActorPropertyTag)_value.type, diff);
            }
            if (OnPropertyUpdate != null)
            {
                OnPropertyUpdate((ActorPropertyTag)_value.type, _value.data, false);
            }
        }
        else if (_value.sort == 2)
        {
            ///这里涉及到一个经验值计算  如果一次获得经验值导致升级多次 则需要把之前的经验累加上
            if (serverData.baseValueDic.ContainsKey((ActorBaseTag)_value.type))
            {
                diff = (int)(ulongVal - serverData.baseValueDic[(ActorBaseTag)_value.type]);
            }
            else
            {
                diff = (int)(_value.data);
            }
            if ((ActorBaseTag)_value.type == ActorBaseTag.Level)
            {
                //Accumulationexp = AddAccumulationExp(Level, (int)_value.data , CurExp);
                uint oldLevel = 0;
                if (serverData.baseValueDic.ContainsKey(ActorBaseTag.Level))
                {
                    oldLevel = (uint)serverData.baseValueDic[ActorBaseTag.Level];
                }
                serverData.baseValueDic[(ActorBaseTag)_value.type] = ulongVal;
                if (OnBaseDiffUpdate != null && diff != 0)
                {
                    OnBaseDiffUpdate((ActorBaseTag)_value.type, diff, false);
                }
                if (OnBaseUpdate != null)
                {
                    OnBaseUpdate((ActorBaseTag)_value.type, ulongVal, false);
                }
                if (GameCenter.instance.isPlatform && serverData.baseValueDic.ContainsKey(ActorBaseTag.Level) && oldLevel != _value.data)
                {
                    int lev = (int)serverData.baseValueDic[ActorBaseTag.Level];
                    LynSdkManager.Instance.UsrLevelUp(lev);
                    //if(GameCenter.instance.isDataEyePattern) DCAccount.setLevel(lev);
                }
            }
            else
            {
                serverData.baseValueDic[(ActorBaseTag)_value.type] = ulongVal;
                if (OnBaseDiffUpdate != null)
                {
                    OnBaseDiffUpdate((ActorBaseTag)_value.type, diff, false);
                }
                if (OnBaseUpdate != null)
                {
                    OnBaseUpdate((ActorBaseTag)_value.type, ulongVal, false);
                }
                if ((ActorBaseTag)_value.type == ActorBaseTag.Camp)
                {
                    SetCamp(_value.data);
                }
                if ((ActorBaseTag)_value.type == ActorBaseTag.SLAVALUE && diff > 0)
                {
                    GameCenter.messageMng.AddClientMsg(493);
                }
            }
        }
    }