예제 #1
0
        private void SumSetter(int idx, float v)
        {
            NumList s        = (NumList)_sums;
            float   oldValue = s.Get(idx);

            s.Set(idx, v);
            OnAlterNumAttribs(idx, oldValue, v);
        }
예제 #2
0
        private void SumSetterNet(int idx, float v)
        {
            NumList  s        = (NumList)_sums;
            float    oldValue = s.Get(idx);
            float    dValue   = v - oldValue;
            bool     bRaw     = false;
            SkEntity entity   = GetModCaster(idx);

            if (FromNet)
            {
                s.Set(idx, v);
                OnAlterNumAttribs(idx, oldValue, v);
            }
            else
            {
                bool bSendDValue = false;
                if (!CheckAttrNet((AttribType)idx, oldValue, v, s, out bSendDValue))
                {
                    return;
                }
                if (bSendDValue && dValue == 0)
                {
                    return;
                }
                if (!bSendDValue)
                {
                    v = CheckAttrMax((AttribType)idx, oldValue, v, (NumList)_sums);
                }
                if (_net != null && LockModifyBySingle)
                {
                    //Debug.Log("attr was locked, please wait for net init data inx = "+idx +" , v = " +v);
                    return;
                }
                if (!bSendDValue)
                {
                    dValue = v;
                    s.Set(idx, v);
                    OnAlterNumAttribs(idx, oldValue, v);
                }
                if (entity != null && _net != null)
                {
                    if (entity.IsController() && !_net.IsStaticNet())
                    {
                        _net.RPCServer(EPacketType.PT_InGame_SKSyncAttr, (byte)idx, dValue, entity.GetId(), bRaw, bSendDValue);
                    }
                }
                else if (_net != null && _net.hasOwnerAuth)
                {
                    _net.RPCServer(EPacketType.PT_InGame_SKSyncAttr, (byte)idx, dValue, -1, bRaw, bSendDValue);
                }
                else if (idx == 95 && _net is MapObjNetwork)
                {
                    _net.RPCServer(EPacketType.PT_InGame_SKSyncAttr, (byte)idx, dValue, -1, bRaw, bSendDValue);
                }
            }
        }
예제 #3
0
 public override float Get(int idx)
 {
     return(_useParentMasks[idx] ? _parent.Get(idx) : base.Get(idx));
 }