internal static TestAPIResult TestEndpoint(MVC.Commands.TestAPICommand cmd) { var wc = WebRequest.CreateHttp(cmd.EndpointUrl.Trim('/') + "/usages"); wc.AllowAutoRedirect = false; wc.Accept = cmd.Accept; wc.Headers.Add("Authorization", string.Format("MetricsEndpoint-Key {0}", cmd.APIKey)); var sb = new StringBuilder(); try { var response = wc.GetResponse() as HttpWebResponse; AppendRequest(wc,sb); AppendResponse(sb,response); if(response.StatusCode!=HttpStatusCode.OK) { return TestAPIResult.Failed(sb.ToString()); } return TestAPIResult.IsSuccess(sb.ToString()); } catch(WebException e) { AppendRequest(wc,sb); AppendResponse(sb,e.Response as HttpWebResponse); return TestAPIResult.Failed(sb.ToString()); } }
internal static void StoreInSession(string sessionId,MVC.Commands.CreateAzureSQLDatabaseCommand cmd) { DataContext.Do(ctx=>{ ctx.AddSQLDatabaseSessions.Add(new AddSQLDatabaseSession { SessionId = sessionId, Username = cmd.Username, Password = cmd.Password, Servername = cmd.Servername }); ctx.SaveChanges(); }); }
protected void RegisterController(string eventName, Type controllerType) { MVC.RegisterController(eventName, controllerType); }
//public abstract void Execute(); protected T GetModel <T>() where T : Model { return(MVC.GetModel <T>() as T); }
protected void RegisterModel(Model model) { MVC.RegisterModel(model); }
protected override void Awake() { base.Awake(); gm = MVC.GetModel <GameModel>(); anim = GetComponentInChildren <Animation>(); }
//发送事件 void SendEvent(string eventName, object data = null) { MVC.SendEvent(eventName, data); }
public override void updateProgress(MVC.Communication.ProgressUpdatedEventArgs e) { if (e.message != null) ProgressBox.Header = e.message; applyProgress(restoreProgress, e); }
/// <summary> /// 注册 VIew /// </summary> /// <param name="view"></param> protected static void RegisterView(View view) { MVC.RegisterView(view); }
public Model GetModel <T>() where T : Model { return(MVC.GetModel <T>()); }
public View GetView <T>() where T : View { return(MVC.GetView <T>()); }
public static void initTorch(MVC mvcCapsule) { capsule.model = mvcCapsule.model.GetComponent <Model>(); capsule.view = mvcCapsule.view.GetComponent <View>(); capsule.controller = mvcCapsule.controller.GetComponent <Controller>(); }
protected override void Awake() { base.Awake(); carTrigger = GetComponentInChildren <CarTrigger>(); gameModel = MVC.GetModel <GameModel>(); }
protected void SendEvent(string eventname, object obj = null) { MVC.SendEvent(eventname, obj); }
protected Model GetModle <T>() where T : Model { return(MVC.GetModel <T>()); }
public void HitAddTime() { MVC.SendEvent(Consts.E_HitAddTimeAttention); }
//bool sin_active; public HexWorld(MVC.View view_, int radius_, float hex_length__ ) { view = view_; map = new List<List<iTile>>(); radius = 2 * radius_ - 1; cur_team_count = 0; tile_size = hex_length__; float tR = (float)(Math.Sqrt(3.0f) * tile_size * 1.25); float tS = (float)(tile_size * 2.5); float tH = (float)(tile_size * 1.25); float center_x = (radius_ - 1) * tR * 2 + tR; if (radius_ % 2 == 0) center_x += tR; float center_y = (radius_ - 1) * (tH + tS) + tS; float map_size = tR * (radius_ - 2) * 2; float map_outer_r = tR * (radius_ - 1) * 2; for (int h = 0; h < radius; h++) { map.Add(new List<iTile>()); for (int w = 0; w < radius; w++) { Vector3 center; center.X = w * tR * 2 + tR; if (h % 2 == 1) center.X += tR; center.Z = h * (tH + tS) + tS; center.Y = 0.0f; // center tile: map[radius_ - 1][radius_ - 1] float scale_size = (float)2.0 * tile_size; iTile tmp; float dist = (float)Math.Sqrt((Math.Abs(center.X - center_x) * Math.Abs(center.X - center_x)) + Math.Abs(center.Z - center_y) * Math.Abs(center.Z - center_y)); bool tmp_flag = false; if (dist > map_outer_r) { tmp = new VoidTile(); } else if (dist > map_size) { tmp = new BoundaryTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h); tmp_flag = true;; } else { tmp = new IceTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h); tmp_flag = true; } map[h].Add(tmp); if (tmp_flag) { view.add_renderable(map[h][w].get_renderable()); } } } }
public void RegisterModel(Model m) { MVC.RegisterModel(m); }
private static void ShareScripts(StringBuilder sb, MVC.MvcResourceManagerConfig config) { if (HttpContext.Current.Items["Ext.Net.GlobaResources"] != null) { List<ResourceItem> scripts = (List<ResourceItem>)HttpContext.Current.Items["Ext.Net.GlobalResources"]; foreach (var item in scripts) { if (item is ClientScriptItem) { var scriptItem = (ClientScriptItem)item; if (config.RenderScripts == ResourceLocationType.Embedded) { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathEmbeddedDebug.IsEmpty()) { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ExtNetTransformer.GetWebResourceUrl(scriptItem.Type, scriptItem.PathEmbedded, config)); } else { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ExtNetTransformer.GetWebResourceUrl(scriptItem.Type, scriptItem.PathEmbeddedDebug, config)); } } else if (config.RenderScripts == ResourceLocationType.File) { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathDebug.IsEmpty()) { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, config.ResourcePath.ConcatWith(scriptItem.Path)); } else { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, config.ResourcePath.ConcatWith(scriptItem.PathDebug)); } } else if (config.RenderScripts == ResourceLocationType.CDN) { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathDebug.IsEmpty()) { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ResourceManager.CDNPath.ConcatWith(scriptItem.Path)); } else { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ResourceManager.CDNPath.ConcatWith(scriptItem.PathDebug)); } } } } } }
public void RegisterView(View v) { MVC.RegisterView(v); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == Tag.Tag_SmallFence) { if (m_isInvincible) { return; } other.gameObject.SendMessage("HitPlayer", transform.position); Game.M_Instance.M_Sound.PlayEffect(Consts.S_Se_UI_Hit); HitObstacles(); } else if (other.gameObject.tag == Tag.Tag_BigFence) { if (m_isInvincible) { return; } if (m_isSlide) { return; } other.gameObject.SendMessage("HitPlayer", transform.position); Game.M_Instance.M_Sound.PlayEffect(Consts.S_Se_UI_Hit); HitObstacles(); } else if (other.gameObject.tag == Tag.Tag_Block) { if (m_isInvincible) { return; } Game.M_Instance.M_Sound.PlayEffect(Consts.S_Se_UI_End); other.gameObject.SendMessage("HitPlayer", transform.position); MVC.SendEvent(Consts.E_EndGameController); } else if (other.gameObject.tag == Tag.Tag_SmallBlock) { if (m_isInvincible) { return; } Game.M_Instance.M_Sound.PlayEffect(Consts.S_Se_UI_End); other.transform.parent.parent.SendMessage("HitPlayer", transform.position); MVC.SendEvent(Consts.E_EndGameController); } else if (other.gameObject.tag == Tag.Tag_BeforeTrigger) { other.transform.parent.SendMessage("HitTrigger", SendMessageOptions.RequireReceiver); } else if (other.gameObject.tag == Tag.Tag_BeforeGoalTrigger) { MVC.SendEvent(Consts.E_HitGoalTriggerAttention); if (m_showHideJiaSu != null) { StopCoroutine(m_showHideJiaSu); } m_showHideJiaSu = ShowHideJiaSu(); StartCoroutine(m_showHideJiaSu); } else if (other.gameObject.tag == Tag.Tag_GoalKeeper) { HitObstacles(); other.transform.parent.parent.parent.SendMessage("HitGoalKeeper", SendMessageOptions.RequireReceiver); } else if (other.gameObject.tag == Tag.Tag_BallDoor) { if (m_isGoal) { m_isGoal = false; return; } HitObstacles(); if (m_showHideNet != null) { StopCoroutine(m_showHideNet); } m_showHideNet = ShowHideNet(); StartCoroutine(m_showHideNet); other.transform.parent.parent.SendMessage("HitDoor", m_nowIndex); } }
public void SendEvent(string eventname, object obj = null) { MVC.SendEvent(eventname, obj); }
/// <summary> /// 注册 COntroller /// </summary> /// <param name="eventName"></param> /// <param name="type"></param> protected static void RegisterControoler(string eventName, Type type) { MVC.RegisterControoler(eventName, type); }
protected void SendEvent(string eventName) { MVC.SendEvent(eventName); }
/// <summary> 启动Controller </summary> protected void SendEvent(string eventName, object args = null) { MVC.SendEvent(eventName, args); }
/// <summary> 注册model </summary> public void RegisterModel(Model model) { MVC.RegisterModel(model); }
protected void SendEvent(string eventNmae, object data = null) { MVC.SendEvent(eventNmae, data); }
/// <summary> 注册view </summary> public void RegisterView(View model) { MVC.RegisterView(model); }
protected T GetView <T>() where T : View { return(MVC.GetView <T>() as T); }
/// <summary> 注册Controller </summary> public static void RegisterController(string eventName, Type controllerType) { MVC.RegisterController(eventName, controllerType); }
protected void RegisterView(View view) { MVC.RegisterView(view); }
private static void ShareStyles(StringBuilder sb, MVC.MvcResourceManagerConfig config) { if (HttpContext.Current.Items[Ext.Net.ResourceManager.GLOBAL_RESOURCES] != null) { var placeholder = HttpContext.Current.Items["Ext.Net.InitStyle"] != null; sb.AppendFormat("<#:item {0}='{1}' index='11'>", placeholder ? "ref" : "selector", placeholder ? "ext.net.initstyle" : "headstart"); List<ResourceItem> styles = (List<ResourceItem>)HttpContext.Current.Items[Ext.Net.ResourceManager.GLOBAL_RESOURCES]; foreach (var item in styles) { if (item is ClientStyleItem) { var styleItem = (ClientStyleItem)item; switch (config.RenderStyles) { case ResourceLocationType.File: sb.AppendFormat(ResourceManager.StyleIncludeTemplate, config.ResourcePath.ConcatWith(styleItem.Path)); break; #if ISPRO case ResourceLocationType.CDN: sb.AppendFormat(ResourceManager.StyleIncludeTemplate, ResourceManager.CDNPath.ConcatWith(styleItem.Path)); break; #endif default : case ResourceLocationType.Embedded: sb.AppendFormat(ResourceManager.StyleIncludeTemplate, ExtNetTransformer.GetWebResourceUrl(styleItem.Type, styleItem.PathEmbedded, config)); break; } } } sb.Append("</#:item>"); } }
//bool sin_active; public World( MVC.View view_, int width__, int height__, float hex_length__ ) { view = view_; map = new List< List<iTile> >(); map_width = width__; map_height = height__; cur_team_count = 0; tile_size = hex_length__; float tR = (float)Math.Sqrt(3.0f) * tile_size / 2; float tS = tile_size; float tH = tile_size / 2; tR *= 2.5f; tS *= 2.5f; tH *= 2.5f; Random rand = new Random(); for (int h = 0; h < map_height; h++) { map.Add(new List<iTile>()); for (int w = 0; w < map_width; w++) { Vector3 center; center.X = w * tR * 2 + tR; if (h % 2 == 1) center.X += tR; center.Z = h * (tH + tS) + tS; center.Y = 0.0f; /* if((Math.Abs(6 - h) + Math.Abs(7 - w)) < 4){ center.Z += 0.6 * tile_size; } else if((Math.Abs(6 - h) + Math.Abs(7 - w)) < 7){ center.Z += 0.2 * tile_size; } */ float scale_size = (float)2.0 * tile_size; iTile tmp; if (h == 0 || h == map_height - 1 || w == 0 || w == map_width - 1) tmp = new BoundaryTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h); else { int randint = rand.Next(3); if(randint == 0) tmp = new IceTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h); else if(randint == 1) tmp = new SoftsnowTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h); else tmp = new HardsnowTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h); } map[h].Add(tmp); view.add_renderable(map[h][w].get_renderable()); } } }
private static void ShareScripts(StringBuilder sb, MVC.MvcResourceManagerConfig config) { if (HttpContext.Current.Items[Ext.Net.ResourceManager.GLOBAL_RESOURCES] != null) { var placeholder = HttpContext.Current.Items["Ext.Net.InitScriptFiles"] != null; sb.AppendFormat("<#:item {0}='{1}' index='21'>", placeholder ? "ref" : "selector", placeholder ? "ext.net.initscriptfiles" : "headstart"); List<ResourceItem> scripts = (List<ResourceItem>)HttpContext.Current.Items[Ext.Net.ResourceManager.GLOBAL_RESOURCES]; foreach (var item in scripts) { if (item is ClientScriptItem) { var scriptItem = (ClientScriptItem)item; if (config.RenderScripts == ResourceLocationType.Embedded) { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathEmbeddedDebug.IsEmpty()) { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ExtNetTransformer.GetWebResourceUrl(scriptItem.Type, scriptItem.PathEmbedded, config)); } else { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ExtNetTransformer.GetWebResourceUrl(scriptItem.Type, scriptItem.PathEmbeddedDebug, config)); } } else if (config.RenderScripts == ResourceLocationType.File) { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathDebug.IsEmpty()) { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, config.ResourcePath.ConcatWith(scriptItem.Path)); } else { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, config.ResourcePath.ConcatWith(scriptItem.PathDebug)); } } #if ISPRO else if (config.RenderScripts == ResourceLocationType.CDN) { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathDebug.IsEmpty()) { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ResourceManager.CDNPath.ConcatWith(scriptItem.Path)); } else { sb.AppendFormat(ResourceManager.ScriptIncludeTemplate, ResourceManager.CDNPath.ConcatWith(scriptItem.PathDebug)); } } #endif } } sb.Append("</#:item>"); } }
private static void ShareStyles(StringBuilder sb, MVC.MvcResourceManagerConfig config) { if (HttpContext.Current.Items["Ext.Net.GlobaResources"] != null) { List<ResourceItem> styles = (List<ResourceItem>)HttpContext.Current.Items["Ext.Net.GlobalResources"]; foreach (var item in styles) { if (item is ClientStyleItem) { var styleItem = (ClientStyleItem)item; switch (config.RenderStyles) { case ResourceLocationType.File: sb.AppendFormat(ResourceManager.StyleIncludeTemplate, config.ResourcePath.ConcatWith(styleItem.Path)); break; default : case ResourceLocationType.Embedded: sb.AppendFormat(ResourceManager.StyleIncludeTemplate, ExtNetTransformer.GetWebResourceUrl(styleItem.Type, styleItem.PathEmbedded, config)); break; } } } } }
internal static TestConnectionResult TestConnection(MVC.Commands.CreateAzureSQLDatabaseCommand cmd) { return SQLDatabaseUsageClient.CreateServerUsagesClient(cmd.Servername,cmd.Username,cmd.Password).TestConnection(); }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <param name="resourceName"></param> /// <param name="config"></param> /// <returns></returns> public static string GetWebResourceUrl(Type type, string resourceName, MVC.MvcResourceManagerConfig config) { if (resourceName.StartsWith(ResourceManager.ASSEMBLYSLUG) && config.CleanResourceUrl && ResourceHandler.HasHandler()) { string buster = (resourceName.EndsWith(".js") || resourceName.EndsWith(".css")) ? "?v=".ConcatWith(ResourceManager.CacheBuster) : ""; return CachedPageInstance.ResolveUrl("~/{0}/ext.axd{1}".FormatWith(resourceName.Replace(ResourceManager.ASSEMBLYSLUG, "").Replace('.', '/').ReplaceLastInstanceOf("/", "-"), buster)); } return HttpUtility.HtmlAttributeEncode(CachedPageInstance.ClientScript.GetWebResourceUrl(type, resourceName)); }
public void initiate(MVC mvcCapsule) { capsule = mvcCapsule; capsule.controller.GetComponent <Controller>().AddObserver(this); }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <param name="resourceName"></param> /// <param name="config"></param> /// <returns></returns> public static string GetWebResourceUrl(Type type, string resourceName, MVC.MvcResourceManagerConfig config) { if (resourceName.StartsWith(ResourceManager.ASSEMBLYSLUG) && config.CleanResourceUrl && ResourceHandler.HasHandler()) { string buster = (resourceName.EndsWith(".js") || resourceName.EndsWith(".css")) ? "?v=".ConcatWith(ResourceManager.CacheBuster) : ""; var url = "~{0}/ext.axd{1}".FormatWith(resourceName.Replace(ResourceManager.ASSEMBLYSLUG, "").Replace('.', '/').ReplaceLastInstanceOf("/", "-"), buster); return System.Web.Mvc.UrlHelper.GenerateContentUrl(url, new HttpContextWrapper(HttpContext.Current)); } return HttpUtility.HtmlAttributeEncode(CachedPageInstance.ClientScript.GetWebResourceUrl(type, resourceName)); }
void Awake() { m_Render = GetComponent <SpriteRenderer>(); gm = MVC.GetModel <GameModel>(); }
protected override void Awake() { base.Awake(); gm = MVC.GetModel <GameModel>(); }
//注册控制器 protected void NewController(string eventName, Type type) { MVC.NewController(eventName, type); }