本文整理汇总了C#中BaseContext类的典型用法代码示例。如果您正苦于以下问题:C# BaseContext类的具体用法?C# BaseContext怎么用?C# BaseContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseContext类属于命名空间,在下文中一共展示了BaseContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNewComputerSteps
public AddNewComputerSteps(BaseContext baseContext)
: base(baseContext)
{
client = new RestClient("http://computer-database.herokuapp.com/");
request = new RestRequest("computers", Method.POST);
newComputer = new NewComputer();
}
示例2: Execute
public override void Execute(Context _context)
{
// action logic here
//if( context.target == null) return;
context = (BaseContext) _context;
context.alive = false;
// Debug.Log("Destroy" + context.gameObject.name);
// context.StartCoroutine(WaitAndDestroy() );
GameObject.Destroy(context.gameObject);
}
示例3: GetRoleCodeList
/// <summary>
/// 根据用户编码取角色集合
/// </summary>
/// <param name="userCode">用户编码</param>
/// <returns></returns>
private static List<string> GetRoleCodeList(string userCode)
{
List<string> list = new List<string>();
using (var context = new BaseContext())
{
if (!string.IsNullOrEmpty(userCode))
{
var user = context.Users.FirstOrDefault(u => u.Code == userCode);
if (user != null)
{
var roleCodes = (from ru in context.RoleUsers
join r in context.Roles on ru.RoleID equals r.ID
where ru.UserID == user.ID
select r.Code
).ToList();
list = roleCodes;
}
}
}
return list;
}
示例4: Execute
public override void Execute(Context _context)
{
// action logic here
//if( context.target == null) return;
context = (BaseContext) _context;
context.alive = false;
// Debug.Log("Destroy" + context.gameObject.name);
// context.StartCoroutine(WaitAndDestroy() );
if(context.lastHit != null){
pc = context.lastHit.GetComponent<PlayerContext>();
player = GameObject.FindObjectOfType(typeof(PlayerContext)) as PlayerContext;
}
if(context.team == 1 && pc == null)
{
// player.streak = 0;
}
else if(context.team == 1 && pc != null){
player.streak += 1;
DisplayBounty();
}
GameObject.Destroy(context.gameObject);
}
示例5: DoResolveTypeParameters
protected virtual bool DoResolveTypeParameters ()
{
var tparams = CurrentTypeParameters;
if (tparams == null)
return true;
var base_context = new BaseContext (this);
for (int i = 0; i < tparams.Count; ++i) {
var tp = tparams[i];
if (!tp.ResolveConstraints (base_context)) {
error = true;
return false;
}
}
if (IsPartialPart) {
PartialContainer.CurrentTypeParameters.UpdateConstraints (this);
}
return true;
}
示例6: ResolveBaseTypes
/// <summary>
/// This function computes the Base class and also the
/// list of interfaces that the class or struct @c implements.
///
/// The return value is an array (might be null) of
/// interfaces implemented (as Types).
///
/// The @base_class argument is set to the base object or null
/// if this is `System.Object'.
/// </summary>
protected virtual TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
{
base_class = null;
if (type_bases == null)
return null;
int count = type_bases.Count;
TypeSpec[] ifaces = null;
var base_context = new BaseContext (this);
for (int i = 0, j = 0; i < count; i++){
FullNamedExpression fne = type_bases [i];
var fne_resolved = fne.ResolveAsType (base_context);
if (fne_resolved == null)
continue;
if (i == 0 && Kind == MemberKind.Class && !fne_resolved.IsInterface) {
if (fne_resolved.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
GetSignatureForError ());
continue;
}
base_type = fne_resolved;
base_class = fne;
continue;
}
if (ifaces == null)
ifaces = new TypeSpec [count - i];
if (fne_resolved.IsInterface) {
for (int ii = 0; ii < j; ++ii) {
if (fne_resolved == ifaces [ii]) {
Report.Error (528, Location, "`{0}' is already listed in interface list",
fne_resolved.GetSignatureForError ());
break;
}
}
if (Kind == MemberKind.Interface && !IsAccessibleAs (fne_resolved)) {
Report.Error (61, fne.Location,
"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
fne_resolved.GetSignatureForError (), GetSignatureForError ());
}
} else {
Report.SymbolRelatedToPreviousError (fne_resolved);
if (Kind != MemberKind.Class) {
Report.Error (527, fne.Location, "Type `{0}' in interface list is not an interface", fne_resolved.GetSignatureForError ());
} else if (base_class != null)
Report.Error (1721, fne.Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
GetSignatureForError (), base_class.GetSignatureForError (), fne_resolved.GetSignatureForError ());
else {
Report.Error (1722, fne.Location, "`{0}': Base class `{1}' must be specified as first",
GetSignatureForError (), fne_resolved.GetSignatureForError ());
}
}
ifaces [j++] = fne_resolved;
}
return ifaces;
}
示例7: DoResolveTypeParameters
protected virtual bool DoResolveTypeParameters ()
{
var tparams = MemberName.TypeParameters;
if (tparams == null)
return true;
var base_context = new BaseContext (this);
for (int i = 0; i < tparams.Count; ++i) {
var tp = tparams[i];
if (!tp.ResolveConstraints (base_context)) {
error = true;
return false;
}
if (IsPartialPart) {
var pc_tp = PartialContainer.CurrentTypeParameters [i];
tp.Create (spec, this);
tp.Define (pc_tp);
if (tp.OptAttributes != null) {
if (pc_tp.OptAttributes == null)
pc_tp.OptAttributes = tp.OptAttributes;
else
pc_tp.OptAttributes.Attrs.AddRange (tp.OptAttributes.Attrs);
}
}
}
if (IsPartialPart) {
PartialContainer.CurrentTypeParameters.UpdateConstraints (this);
}
return true;
}
示例8: DoResolveTypeParameters
protected virtual bool DoResolveTypeParameters ()
{
if (CurrentTypeParameters == null)
return true;
if (PartialContainer != this)
throw new InternalErrorException ();
var base_context = new BaseContext (this);
foreach (TypeParameter type_param in CurrentTypeParameters) {
if (!type_param.ResolveConstraints (base_context)) {
error = true;
return false;
}
}
if (partial_parts != null) {
foreach (TypeContainer part in partial_parts)
UpdateTypeParameterConstraints (part);
}
return true;
}
示例9: DoResolveTypeParameters
protected virtual bool DoResolveTypeParameters ()
{
var tparams = CurrentTypeParameters;
if (tparams == null)
return true;
if (PartialContainer != this)
throw new InternalErrorException ();
var base_context = new BaseContext (this);
for (int i = 0; i < tparams.Count; ++i) {
var tp = tparams[i];
if (!tp.ResolveConstraints (base_context)) {
error = true;
return false;
}
}
if (partial_parts != null) {
foreach (TypeContainer part in partial_parts)
UpdateTypeParameterConstraints (part);
}
return true;
}
示例10: ResolveBaseTypes
/// <summary>
/// This function computes the Base class and also the
/// list of interfaces that the class or struct @c implements.
///
/// The return value is an array (might be null) of
/// interfaces implemented (as Types).
///
/// The @base_class argument is set to the base object or null
/// if this is `System.Object'.
/// </summary>
protected virtual TypeExpr[] ResolveBaseTypes (out TypeExpr base_class)
{
base_class = null;
if (type_bases == null)
return null;
int count = type_bases.Count;
TypeExpr [] ifaces = null;
IMemberContext base_context = new BaseContext (this);
for (int i = 0, j = 0; i < count; i++){
FullNamedExpression fne = (FullNamedExpression) type_bases [i];
//
// Standard ResolveAsTypeTerminal cannot be used in this case because
// it does ObsoleteAttribute and constraint checks which require
// base type to be set
//
TypeExpr fne_resolved = fne.ResolveAsBaseTerminal (base_context, false);
if (fne_resolved == null)
continue;
if (i == 0 && Kind == Kind.Class && !fne_resolved.Type.IsInterface) {
if (fne_resolved is DynamicTypeExpr)
Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
GetSignatureForError ());
else
base_class = fne_resolved;
continue;
}
if (ifaces == null)
ifaces = new TypeExpr [count - i];
if (fne_resolved.Type.IsInterface) {
for (int ii = 0; ii < j; ++ii) {
if (TypeManager.IsEqual (fne_resolved.Type, ifaces [ii].Type)) {
Report.Error (528, Location, "`{0}' is already listed in interface list",
fne_resolved.GetSignatureForError ());
break;
}
}
if (Kind == Kind.Interface && !IsAccessibleAs (fne_resolved.Type)) {
Report.Error (61, fne.Location,
"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
fne_resolved.GetSignatureForError (), GetSignatureForError ());
}
} else {
Report.SymbolRelatedToPreviousError (fne_resolved.Type);
if (Kind != Kind.Class) {
Report.Error (527, fne.Location, "Type `{0}' in interface list is not an interface", fne_resolved.GetSignatureForError ());
} else if (base_class != null)
Report.Error (1721, fne.Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
GetSignatureForError (), base_class.GetSignatureForError (), fne_resolved.GetSignatureForError ());
else {
Report.Error (1722, fne.Location, "`{0}': Base class `{1}' must be specified as first",
GetSignatureForError (), fne_resolved.GetSignatureForError ());
}
}
ifaces [j++] = fne_resolved;
}
return ifaces;
}