示例#1
0
    private void HitCell(ClickInfo hit_cell)
    {
        if (hit_cell != null && hit_cell.cell != null)
        {
            if (!IsDudeSelected())
            {
                UnitImpl hit_dude = hit_cell.cell.cell.unit;
                if (hit_dude != null && !hit_dude.made_move && hit_dude.command_idx == gameboard_impl.cur_command_idx) //There is dude standing on this cell!!!
                {
                    hit_cell.cell.SetStatus(CellData.Status.Selected);

                    NewMovesAvailable(hit_dude.GetMoves(gameboard_impl));
                }
            }
            else
            {
                List <Move> sel_move = GetSelectedMove(hit_cell);
                if (sel_move != null && sel_move.Count == 1)
                {
                    sel_move[0].MakeMove(gameboard_impl);
                }

                ClearAvailableCells();

                if (sel_move != null && sel_move.Count > 1)
                {
                    NewMovesAvailable(sel_move);
                    first_selected_cell = hit_cell.cell.cell;
                }
            }
        }
    }
示例#2
0
    public void OnFingerDown(int fingerIndex, Vector2 fingerPos)
    {
#if IPHONE || ANDROID
        if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
        {
#else
        if (EventSystem.current.IsPointerOverGameObject())
        {
#endif
            Debug.Log("点击到UI");
            return;
        }
        GameObject obj = PickObject(fingerPos);
        if (obj != null && obj.GetComponent <ClickInfo>() != null)
        {
            ClickInfo temp = obj.GetComponent <ClickInfo>();
            temp.fingerDown(temp);
            GameManager.getInstance().curClickInfo = temp;
        }
        else
        {
            UiManager.Instance.CloseClickPanels();
            GameManager.getInstance().curClickInfo = null;
        }
    }
示例#3
0
 public override void LoadModel()
 {
     towerAsset = GameLoader.Instance.LoadAssetSync("Resources/Prefabs/MageTower.prefab");
     towerObj   = towerAsset.GameObjectAsset;
     towerObj.transform.position = this.towerInfo.GetPosition();
     if (towerObj.GetComponent <ClickInfo>() == null)
     {
         ClickInfo clickInfo = towerObj.AddComponent <ClickInfo>();
         clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
     }
     else
     {
         ClickInfo clickInfo = towerObj.GetComponent <ClickInfo>();
         clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
     }
     //加载塔身图片
     if (towerObj.GetComponent <Animate>() != null)
     {
         towerBase = towerObj.GetComponent <Animate>();
     }
     else
     {
         towerBase = towerObj.AddComponent <Animate>();
     }
     towerBase.OnInit(towerInfo.towerBase);
     towerBase.startAnimation("idle");
 }
示例#4
0
        public void RecordClick(string str1, string str2)
        {
            ClickInfo obj = new ClickInfo {
                count = 1, TrackName = str1, TrackURL = str2
            };

            _db.ClickInfo.Add(obj);
            _db.SaveChanges();
        }
示例#5
0
    /// <summary>
    /// 查找是否插入过
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    public static bool SelectHasCount(ClickInfo info)
    {
        DataTable dt = DBHelper.ExecuteDataTable(SQL_SELECT_HASCOUNT, CreateParameter(info));

        foreach (DataRow dr in dt.Rows)
        {
            return(int.Parse(dr[0].ToString()) == 0 ? false : true);
        }

        return(false);
    }
 public override void FingerDown(ClickInfo curClick)
 {
     if (UiManager.Instance.HasOpenUI(UIDefine.eSelectPanel))
     {
         UiManager.Instance.CloseUIById(UIDefine.eSelectPanel);
     }
     else
     {
         UiManager.Instance.OpenUI(UIDefine.eSelectPanel, towerInfo);
     }
 }
示例#7
0
    private static SqlParameter[] CreateParameter(ClickInfo info)
    {
        SqlParameter[] param = new[]
        {
            new SqlParameter("@UserAdsId", info.UserAdsId),
            new SqlParameter("@ClickCount", info.ClickCount),
            new SqlParameter("@ClickDate", info.ClickDate),
            new SqlParameter("@ClickType", info.ClickType)
        };

        return(param);
    }
        private void OnClick(object sender, EventArgs args)
        {
            ClickInfo info = args as ClickInfo;

            if (info != null)
            {
                if (info.State != GestureState.NULL)
                {
                    Console.WriteLine(String.Format("Click :: state={0} X={1} Y={2} Z={3}",
                                                    info.State,
                                                    info.StablePos.x, info.StablePos.y, info.StablePos.z));
                }
            }
        }
示例#9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            System.Collections.Specialized.NameValueCollection s = Request.QueryString;

            if (s.Count != 1)
            {
                return;
            }
            string query = HttpUtility.UrlDecode(s.ToString());

            if (query.Contains("id=") && query.Contains("url="))
            {
                string date = DateTime.Now.ToString("yyyyMMdd");
                Guid   id;
                try
                {
                    id = new Guid(query.Substring(query.IndexOf("=") + 1, query.IndexOf("&") - 3));
                }
                catch
                {
                    return;
                }
                int type = string.IsNullOrEmpty(Request.QueryString["type"]) ? 1 : 0;

                ClickInfo info = new ClickInfo();
                info.ClickType = type;
                info.ClickDate = date;
                info.UserAdsId = id;

                if (ClickService.SelectHasCount(info))
                {
                    ClickService.UpdateClickInfo(info);
                }
                else
                {
                    info.ClickCount = 1;
                    ClickService.InsertClickInfo(info);
                }

                string url = query.Substring(query.IndexOf("url=") + 4);
                url = url.Contains("?") ? url + "&" : url + "?";

                Response.Write(@"<script language='javascript' type='text/javascript'  src='http://js.users.51.la/12120626.js'></script><script>if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
var referLink=document.createElement('a');
referLink.href='" + url + "spm=2018.12167184.0.0';document.body.appendChild(referLink);referLink.click();}else{location.href='" + url + "spm=2018.12167184.0.0';}</script>");
            }
        }
    }
示例#10
0
    private void HandleNonTargetInput()
    {
        if (inputDelayActive)
        {
            return;
        }

        var       mouseLocation = GetGlobalMousePosition();
        ClickInfo clickInfo     = new ClickInfo();

        if (Input.IsActionJustPressed("left_click"))         //Initial click
        {
            mousePressOrigin = mouseLocation;
        }

        if (Input.IsActionPressed("left_click") && !isMouseDragging)
        {
            if (mouseLocation.x > mousePressOrigin.x + mouseClickMoveTolerance ||
                mouseLocation.x < mousePressOrigin.x - mouseClickMoveTolerance ||
                mouseLocation.y > mousePressOrigin.y + mouseClickMoveTolerance ||
                mouseLocation.y < mousePressOrigin.y - mouseClickMoveTolerance)
            {
                isMouseDragging = true;
            }
        }

        if (isMouseDragging)
        {
            HandleMouseDrag();
        }

        if (Input.IsActionJustReleased("left_click") && !isMouseDragging)         //Mouse up, normal click
        {
            IMapClickable clickTarget = GetMostClickableAt(mouseLocation);

            clickInfo.ButtonNumber = 1;
            clickInfo.ModifyHeld   = (Input.IsActionPressed("modify"));

            if (clickTarget != null)
            {
                clickTarget.ClickAction(clickInfo, mouseLocation);
            }
        }
        else if (Input.IsActionJustReleased("left_click") && isMouseDragging)
        {
            isMouseDragging = false;
        }
    }
示例#11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            System.Collections.Specialized.NameValueCollection s = Request.QueryString;

            if (s.Count != 1)
            {
                return;
            }
            string query = HttpUtility.UrlDecode(s.ToString());

            if (query.Contains("id=") && query.Contains("url="))
            {
                string date = DateTime.Now.ToString("yyyyMMdd");
                Guid   id;
                try
                {
                    id = new Guid(query.Substring(query.IndexOf("=") + 1, query.IndexOf("&") - 3));
                }
                catch
                {
                    return;
                }
                int type = string.IsNullOrEmpty(Request.QueryString["type"]) ? 1 : 0;

                ClickInfo info = new ClickInfo();
                info.ClickType = type;
                info.ClickDate = date;
                info.UserAdsId = id;

                if (ClickService.SelectHasCount(info))
                {
                    ClickService.UpdateClickInfo(info);
                }
                else
                {
                    info.ClickCount = 1;
                    ClickService.InsertClickInfo(info);
                }

                string url = query.Substring(query.IndexOf("url=") + 4);
                url = url.Contains("?") ? url + "&" : url + "?";

                Response.Redirect(url);
            }
        }
    }
示例#12
0
    //被点击
    public virtual void FingerDown(ClickInfo curClick)
    {
        ClickInfo preClick = GameManager.getInstance().curClickInfo;

        //如果上次点击 点中可交互物体,并且类型相同,Id不同,即点中其他塔,立刻关闭UI
        if (preClick != null && preClick.clickType == curClick.clickType && preClick.Id != curClick.Id)
        {
            UiManager.Instance.CloseUIById(UIDefine.eSelectPanel);
            UiManager.Instance.OpenUI(UIDefine.eSelectPanel, towerInfo);
        }
        else if (UiManager.Instance.HasOpenUI(UIDefine.eSelectPanel))
        {
            UiManager.Instance.CloseUIById(UIDefine.eSelectPanel);
        }
        else
        {
            UiManager.Instance.OpenUI(UIDefine.eSelectPanel, towerInfo);
        }
    }
    public override void LoadModel()
    {
        towerAsset = GameLoader.Instance.LoadAssetSync("Resources/Prefabs/OpenSpace.prefab");
        towerObj   = towerAsset.GameObjectAsset;
        towerObj.transform.position = this.towerInfo.GetPosition();
        if (towerObj.GetComponent <ClickInfo>() == null)
        {
            ClickInfo clickInfo = towerObj.AddComponent <ClickInfo>();
            clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
        }
        else
        {
            ClickInfo clickInfo = towerObj.GetComponent <ClickInfo>();
            clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
        }
        //加载空地图片
        if (towerObj.GetComponent <SpriteImage>() != null)
        {
            towerBase = towerObj.GetComponent <SpriteImage>();
        }
        else
        {
            towerBase = towerObj.AddComponent <SpriteImage>();
        }
        towerBase.OnInit(towerInfo.towerBase);
        //根据塔基座大小增加碰撞盒
        BoxCollider collider;

        if (towerObj.GetComponent <BoxCollider>() == null)
        {
            collider      = towerObj.AddComponent <BoxCollider>();
            collider.size = new Vector3(towerBase.width, towerBase.height, 0.2f);
        }
        else
        {
            collider      = towerObj.GetComponent <BoxCollider>();
            collider.size = new Vector3(towerBase.width, towerBase.height, 0.2f);
        }
    }
示例#14
0
    public IList <ClickInfo> SelectAllClickCount(string start, string end)
    {
        SqlParameter[] param = new[]
        {
            new SqlParameter("@start", start),
            new SqlParameter("@end", end)
        };

        DataTable         dt   = DBHelper.ExecuteDataTable(SQL_SELCT_ALLCLICK_BY_DATE, param);
        IList <ClickInfo> list = new List <ClickInfo>();

        foreach (DataRow dr in dt.Rows)
        {
            ClickInfo info = new ClickInfo();
            info.UserAdsId  = new Guid(dr["UserAdsId"].ToString());
            info.ClickCount = int.Parse(dr["ClickCount"].ToString());

            list.Add(info);
        }

        return(list);
    }
示例#15
0
        public void ConfigureMouseClickEvent(UIElement element, Action <object, MouseEventArgs> action)
        {
            MouseClickConfigurationInfo[element] = new ClickInfo(action);
            element.MouseDown += new MouseButtonEventHandler((sender, e) =>
            {
                MouseClickConfigurationInfo[element].Clicked = true;
            });
            element.MouseUp += new MouseButtonEventHandler((sender, e) =>
            {
                var info = MouseClickConfigurationInfo[element];

                if (info.Clicked)
                {
                    info.Clicked = false;
                    info.Action(sender, e);
                }
            });
            element.MouseLeave += new MouseEventHandler((sender, e) =>
            {
                MouseClickConfigurationInfo[element].Clicked = false;
            });
        }
示例#16
0
    private ClickInfo FindCellUnderMouse()
    {
        Ray        ray = Camera.main.ScreenPointToRay(UniversalInput.MousePos());
        RaycastHit hit;

        ClickInfo ret = null;

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 8))
        {
            if (hit.transform.gameObject.tag == "Cell")
            {
                ret             = new ClickInfo(hit.transform.gameObject.GetComponent <CellData> ());
                ret.click_point = hit.point;
            }
            else if (hit.transform.gameObject.tag == "EndMove")            // ToDo move to another method
            {
                if (!IsDudeSelected())
                {
                    ChangeCommand();
                }
            }

            /*else
             * {
             * GameObject obj = hit.transform.gameObject;
             * while (obj.transform.parent != null)
             * {
             * obj = obj.transform.parent.gameObject;
             * }
             *      if( obj.GetComponent<DudeData>() )
             *              ret = GameBoard.instance.FindCell(obj.GetComponent<DudeData>().unit.oriented_cell.cell);
             * }*/
        }

        return(ret);
    }
示例#17
0
 public abstract void SendEvent(ClickInfo info);
示例#18
0
 public abstract void SendEvent(ClickInfo info);
示例#19
0
 public void ClickAction(ClickInfo info, Vector2 location)
 {
     LocalCharacterManager.MapClick(ToLocal(location), nav);
 }
示例#20
0
 public static int UpdateClickInfo(ClickInfo info)
 {
     return(DBHelper.ExecuteNonQuery(SQL_UPDATE, CreateParameter(info)));
 }
示例#21
0
 public void ClickAction(ClickInfo info, Vector2 location)
 {
     //TODO Use location to determine which side of enemy to stand on (if needed)
     LocalCharacterManager.EnemyClicked(this);
 }
示例#22
0
 public void ClickAction(ClickInfo info, Vector2 location)
 {
     LocalCharacterManager.SelectPartyMember(this, !info.ModifyHeld);
     GUIManager.SelectPartyMember(PartyMemberOrder);
 }
示例#23
0
    private List <Move> GetSelectedMove(ClickInfo hit_cell)
    {
        List <Move> ret = null;

        if (IsDudeSelected() && hit_cell != null && hit_cell.cell != null)
        {
            List <Move> kills = available_moves.FindAll(move => move.Type == Move.MoveType.Kill &&
                                                        (move as KillMoveImpl).UnitToKillPlace == hit_cell.cell.cell);

            if (ret == null && kills.Count > 0 && first_selected_cell == null)              //ToDo select shortest move
            {
                ret = kills;
            }

            if (ret == null)
            {
                Move        one_move = null;
                List <Move> moves    = available_moves.FindAll
                                       (
                    move =>
                    (
                        move.Type == Move.MoveType.Move
                        ||
                        move.Type == Move.MoveType.Card
                        ||
                        (first_selected_cell != null && move.Type == Move.MoveType.Kill)
                    )
                    &&
                    Array.IndexOf
                    (
                        gameboard_impl.GetOccupatedCells
                        (
                            (move as MoveImpl).GetTargetCell(gameboard_impl)
                        )
                        ,
                        hit_cell.cell.cell
                    ) > -1
                                       );

                one_move = moves.Count > 0 ? moves [0] : null;

                if (hit_cell.click_point.y != 666)
                {
                    Vector2 pos = new Vector2(hit_cell.click_point.x, hit_cell.click_point.z);

                    Func <Move, float> GetDist = move => (FindTargetCellPlace(move as MoveImpl) - pos).magnitude;

                    moves.ForEach
                    (
                        move =>
                    {
                        if (GetDist(move) < GetDist(one_move))
                        {
                            one_move = move;
                        }
                    }
                    );
                }

                if (one_move != null)
                {
                    ret = new List <Move> ();
                    ret.Add(one_move);
                }
            }
        }
        return(ret);
    }
示例#24
0
 public static int InsertClickInfo(ClickInfo info)
 {
     return(DBHelper.ExecuteNonQuery(SQL_INSERT, CreateParameter(info)));
 }
示例#25
0
    public override void LoadModel()
    {
        towerAsset = GameLoader.Instance.LoadAssetSync("Resources/Prefabs/ArrowTower.prefab");
        towerObj   = towerAsset.GameObjectAsset;
        towerObj.transform.position = this.towerInfo.GetPosition();
        if (towerObj.GetComponent <ClickInfo>() == null)
        {
            ClickInfo clickInfo = towerObj.AddComponent <ClickInfo>();
            clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
        }
        else
        {
            ClickInfo clickInfo = towerObj.GetComponent <ClickInfo>();
            clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
        }
        //加载塔身图片
        GameObject towerBaseObj = towerObj.transform.Find("ArrowTowerBase").gameObject;
        Vector3    towerBasePos = towerBaseObj.transform.position;

        towerBasePos.z += 5f;
        towerBaseObj.transform.position = towerBasePos;
        if (towerBaseObj.GetComponent <SpriteImage>() != null)
        {
            towerBase = towerBaseObj.GetComponent <SpriteImage>();
        }
        else
        {
            towerBase = towerBaseObj.AddComponent <SpriteImage>();
        }
        towerBase.OnInit(towerInfo.towerBase);
        //加载射手1
        GameObject shooterObj1 = towerObj.transform.Find("ArrowShooter1").gameObject;

        if (shooterObj1.GetComponent <Animate>() != null)
        {
            shooter1 = shooterObj1.GetComponent <Animate>();
        }
        else
        {
            shooter1 = shooterObj1.AddComponent <Animate>();
        }
        shooter1.OnInit(towerInfo.shooter);
        shooter1.startAnimation("idle");
        //加载射手2
        GameObject shooterObj2 = towerObj.transform.Find("ArrowShooter2").gameObject;

        if (shooterObj2.GetComponent <Animate>() != null)
        {
            shooter2 = shooterObj2.GetComponent <Animate>();
        }
        else
        {
            shooter2 = shooterObj2.AddComponent <Animate>();
        }

        //根据塔基座大小增加碰撞盒
        BoxCollider collider;

        if (towerObj.GetComponent <BoxCollider>() == null)
        {
            collider      = towerObj.AddComponent <BoxCollider>();
            collider.size = new Vector3(towerBase.width, towerBase.height, 0.2f);
        }
        else
        {
            collider      = towerObj.GetComponent <BoxCollider>();
            collider.size = new Vector3(towerBase.width, towerBase.height, 0.2f);
        }
        shooter2.OnInit(towerInfo.shooter);
        shooter2.startAnimation("idle");
    }