Пример #1
0
        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());
            }
        }
Пример #2
0
		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();
			});
		}
Пример #3
0
 protected void RegisterController(string eventName, Type controllerType)
 {
     MVC.RegisterController(eventName, controllerType);
 }
Пример #4
0
    //public abstract void Execute();

    protected T GetModel <T>()
        where T : Model
    {
        return(MVC.GetModel <T>() as T);
    }
Пример #5
0
 protected void RegisterModel(Model model)
 {
     MVC.RegisterModel(model);
 }
Пример #6
0
 protected override void Awake()
 {
     base.Awake();
     gm   = MVC.GetModel <GameModel>();
     anim = GetComponentInChildren <Animation>();
 }
Пример #7
0
 //发送事件
 void SendEvent(string eventName, object data = null)
 {
     MVC.SendEvent(eventName, data);
 }
Пример #8
0
 public override void updateProgress(MVC.Communication.ProgressUpdatedEventArgs e)
 {
     if (e.message != null)
         ProgressBox.Header = e.message;
     applyProgress(restoreProgress, e);
 }
Пример #9
0
 /// <summary>
 /// 注册 VIew
 /// </summary>
 /// <param name="view"></param>
 protected static void RegisterView(View view)
 {
     MVC.RegisterView(view);
 }
Пример #10
0
 public Model GetModel <T>() where T : Model
 {
     return(MVC.GetModel <T>());
 }
Пример #11
0
 public View GetView <T>() where T : View
 {
     return(MVC.GetView <T>());
 }
Пример #12
0
 public static void initTorch(MVC mvcCapsule)
 {
     capsule.model      = mvcCapsule.model.GetComponent <Model>();
     capsule.view       = mvcCapsule.view.GetComponent <View>();
     capsule.controller = mvcCapsule.controller.GetComponent <Controller>();
 }
Пример #13
0
 protected override void Awake()
 {
     base.Awake();
     carTrigger = GetComponentInChildren <CarTrigger>();
     gameModel  = MVC.GetModel <GameModel>();
 }
Пример #14
0
 protected void SendEvent(string eventname, object obj = null)
 {
     MVC.SendEvent(eventname, obj);
 }
Пример #15
0
 protected Model GetModle <T>() where T : Model
 {
     return(MVC.GetModel <T>());
 }
Пример #16
0
 public void HitAddTime()
 {
     MVC.SendEvent(Consts.E_HitAddTimeAttention);
 }
Пример #17
0
        //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());
                    }

                }
            }
        }
Пример #18
0
 public void RegisterModel(Model m)
 {
     MVC.RegisterModel(m);
 }
Пример #19
0
        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));
                            }
                        }
                    }
                }
            }
        }
Пример #20
0
 public void RegisterView(View v)
 {
     MVC.RegisterView(v);
 }
Пример #21
0
    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);
        }
    }
Пример #22
0
 public void SendEvent(string eventname, object obj = null)
 {
     MVC.SendEvent(eventname, obj);
 }
Пример #23
0
 /// <summary>
 /// 注册 COntroller
 /// </summary>
 /// <param name="eventName"></param>
 /// <param name="type"></param>
 protected static void RegisterControoler(string eventName, Type type)
 {
     MVC.RegisterControoler(eventName, type);
 }
Пример #24
0
 protected void SendEvent(string eventName)
 {
     MVC.SendEvent(eventName);
 }
Пример #25
0
 /// <summary> 启动Controller </summary>
 protected void SendEvent(string eventName, object args = null)
 {
     MVC.SendEvent(eventName, args);
 }
Пример #26
0
 /// <summary> 注册model </summary>
 public void RegisterModel(Model model)
 {
     MVC.RegisterModel(model);
 }
Пример #27
0
 protected void SendEvent(string eventNmae, object data = null)
 {
     MVC.SendEvent(eventNmae, data);
 }
Пример #28
0
 /// <summary> 注册view </summary>
 public void RegisterView(View model)
 {
     MVC.RegisterView(model);
 }
Пример #29
0
 protected T GetView <T>()
     where T : View
 {
     return(MVC.GetView <T>() as T);
 }
Пример #30
0
 /// <summary> 注册Controller </summary>
 public static void RegisterController(string eventName, Type controllerType)
 {
     MVC.RegisterController(eventName, controllerType);
 }
Пример #31
0
 protected void RegisterView(View view)
 {
     MVC.RegisterView(view);
 }
Пример #32
0
        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>");
            }
        }
Пример #33
0
        //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());

                }
            }
        }
Пример #34
0
        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>");
            }
        }
Пример #35
0
        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;
                        }
                    }
                }
            }
        }
Пример #36
0
		internal static TestConnectionResult TestConnection(MVC.Commands.CreateAzureSQLDatabaseCommand cmd) {
			return SQLDatabaseUsageClient.CreateServerUsagesClient(cmd.Servername,cmd.Username,cmd.Password).TestConnection();
		}
Пример #37
0
        /// <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));
        }
Пример #38
0
 public void initiate(MVC mvcCapsule)
 {
     capsule = mvcCapsule;
     capsule.controller.GetComponent <Controller>().AddObserver(this);
 }
Пример #39
0
        /// <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));
        }
Пример #40
0
 void Awake()
 {
     m_Render = GetComponent <SpriteRenderer>();
     gm       = MVC.GetModel <GameModel>();
 }
Пример #41
0
 protected override void Awake()
 {
     base.Awake();
     gm = MVC.GetModel <GameModel>();
 }
Пример #42
0
    //注册控制器

    protected void NewController(string eventName, Type type)
    {
        MVC.NewController(eventName, type);
    }