public void EmitAddSettings(CodeExpression expr, CodeStatementCollection statements, Offsets offsets) { // fix for transfer from old system if (Decorator.Definition.Controller) { Decorator.Definition.ReplicationMode = ReplicationMode.Everyone; } int filters = 0; switch (Decorator.Definition.ReplicationMode) { case ReplicationMode.Everyone: filters |= (1 << 30); filters |= (1 << 31); break; case ReplicationMode.EveryoneExceptController: filters |= (1 << 30); break; case ReplicationMode.OnlyOwnerAndController: filters |= (1 << 31); break; } statements.Call(expr, "Settings_Property", Decorator.Definition.Name.Literal(), Decorator.Definition.Priority.Literal(), filters.Literal() ); statements.Call(expr, "Settings_Offsets", offsets.OffsetProperties, offsets.OffsetStorage ); // mecanim for states settings if ((Decorator.DefiningAsset is StateDecorator) && Decorator.Definition.PropertyType.MecanimApplicable) { PropertyStateSettings s = Decorator.Definition.StateAssetSettings; statements.Call(expr, "Settings_Mecanim", s.MecanimMode.Literal(), s.MecanimDirection.Literal(), s.MecanimDamping.Literal(), s.MecanimLayer.Literal() ); } // collecting property specific settings AddSettings(expr, statements); }
public override void AddSettings(CodeExpression expr, CodeStatementCollection statements) { if (Decorator.PropertyType.CompressionEnabled) { statements.Call(expr, "Settings_Integer", "Ascension.Networking.PropertyIntCompressionSettings.Create({0}, {1})".Expr(Decorator.PropertyType.BitsRequired, -Decorator.PropertyType.MinValue) ); } else { statements.Call(expr, "Settings_Integer", "Ascension.Networking.PropertyIntCompressionSettings.Create()".Expr()); } }
public void EmitQuaternionSettings(CodeExpression expr, CodeStatementCollection statements, FloatCompression[] axes, FloatCompression quaternion, AxisSelections selection, bool strictCompare) { if (selection != AxisSelections.Disabled) { if (axes == null || quaternion == null || selection == AxisSelections.XYZ) { statements.Call(expr, "Settings_Quaternion", CreateFloatCompressionExpression(quaternion, true), strictCompare.Literal()); } else { List <CodeExpression> exprs = CreateAxisCompressionExpression(axes, selection); exprs.Add(strictCompare.Literal()); statements.Call(expr, "Settings_QuaternionEuler", exprs.ToArray()); } } }
public void EmitVectorSettings(CodeExpression expr, CodeStatementCollection statements, FloatCompression[] axes, AxisSelections selection, bool strictCompare) { if (selection != AxisSelections.Disabled) { List <CodeExpression> exprs = CreateAxisCompressionExpression(axes, selection); exprs.Add(strictCompare.Literal()); statements.Call(expr, "Settings_Vector", exprs.ToArray()); } }
public override void AddSettings(CodeExpression expr, CodeStatementCollection statements) { if (Decorator.DefiningAsset is StateDecorator) { statements.Call(expr, "Settings_Float", "new Ascension.Networking.PropertyFloatSettings {{ IsAngle = {0} }}".Expr( Decorator.PropertyType.IsAngle.ToString().ToLowerInvariant())); } EmitFloatSettings(expr, statements, Decorator.PropertyType.Compression); EmitInterpolationSettings(expr, statements); }
private void EmitExtrapolationSettings(CodeExpression expr, CodeStatementCollection stmts) { PropertyStateSettings s = Decorator.Definition.StateAssetSettings; stmts.Call(expr, "Settings_Extrapolation", "Ascension.Networking.PropertyExtrapolationSettings".Expr().Call("Create", s.ExtrapolationMaxFrames.Literal(), s.ExtrapolationErrorTolerance.Literal(), s.SnapMagnitude.Literal(), Decorator.PropertyType.ExtrapolationVelocityMode.Literal() ) ); }
public override void AddSettings(CodeExpression expr, CodeStatementCollection stmts) { PropertyTypeTransform pt = Decorator.PropertyType; stmts.Call(expr, "Settings_Space", "Ascension.Networking.TransformSpaces.{0}".Expr(Decorator.PropertyType.Space)); EmitVectorSettings(expr, stmts, pt.PositionCompression, pt.PositionSelection, pt.PositionStrictCompare); EmitQuaternionSettings(expr, stmts, pt.RotationCompression, pt.RotationCompressionQuaternion, pt.RotationSelection, pt.RotationStrictCompare); switch (Decorator.Definition.StateAssetSettings.SmoothingAlgorithm) { case SmoothingAlgorithms.Interpolation: EmitInterpolationSettings(expr, stmts); break; case SmoothingAlgorithms.Extrapolation: EmitExtrapolationSettings(expr, stmts); break; } }
public void EmitFloatSettings(CodeExpression expr, CodeStatementCollection statements, FloatCompression c) { statements.Call(expr, "Settings_Float", CreateFloatCompressionExpression(c, true)); }
public override void AddSettings(CodeExpression expr, CodeStatementCollection statements) { statements.Call(expr, "AddStringSettings", Decorator.PropertyType.Encoding.Literal()); }