unity3d在android安卓中用啥代替pc上的OnMouseDown函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了unity3d在android安卓中用啥代替pc上的OnMouseDown函数相关的知识,希望对你有一定的参考价值。

Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices.

参考技术A onMouseDown
一样的用,只是方法体需要的输入函数不一样,手机你直接用Input.touchCount,这个函数返回的是屏幕当前被触摸的数量,==1就是单点触摸
Input.GetTouch(0).phase 返回的是触摸后的事件类型,比如移动就是Input.GetTouch(触摸点的索引,0代表第一根指头).phase==TouchPhase.Moved,具体有哪些类型,可以在编译器里面 “点” 出来看看
参考技术B function Update ()
for (var touch : Touch in Input.touches)
if (touch.phase == TouchPhase.Began)



另外,unity会自动改的
参考技术C function Update ()
for (var touch : Touch in Input.touches)
if (touch.phase == TouchPhase.Began)


本回答被提问者和网友采纳
参考技术D function Update ()
for (var touch : Touch in Input.touches)
if (touch.phase == TouchPhase.Began)

第5个回答  2016-03-15 这种专业的问题还是去相应的论坛去发帖,这里很少有这么专业的~

java Spring Boot中用啥代替“System.out.println”

【中文标题】java Spring Boot中用啥代替“System.out.println”【英文标题】:What to use instead of "System.out.println" in java Spring Bootjava Spring Boot中用什么代替“System.out.println” 【发布时间】:2020-05-15 19:07:55 【问题描述】:
@RequestMapping(method=RequestMethod.POST, value= "/LMSServer/getNoOfDaysOfApplicationBycellNo" )
@PreAuthorize("hasAuthority('CUSTOMER_MANAGEMENT_R') OR hasAuthority('CUSTOMER_MANAGEMENT_RW')")
public BasicResponce getNoOfDaysOfApplicationBycellNo(@RequestParam(value = "cellNo") long cellNo)

    if(LOG.isInfoEnabled())
        LOG.info("WebClientRestContoller.getNoOfDaysOfApplicationBycellNo--Start");
        LOG.info("Cell NO: "+cellNo);
    

    BasicResponce authResp = null;
    try 

        Customer fromDB= (Customer) objLMSDAO.getDetailsByCellno(cellNo);
        DaysOfApplicationResponseDTO toSend= new DaysOfApplicationResponseDTO();

        toSend.setCreatedAt(fromDB.getCreatedAt()+"");
        toSend.setUpdatedAt(fromDB.getUpdatedAt()+"");

        toSend.setRequested_Action(true);

        authResp=toSend;    


         catch (Exception e) 
            e.printStackTrace();
        

        if(LOG.isInfoEnabled())
            LOG.info("Returned Response is:");
            LOG.info("Response Requested_Action:  ",new Object[]authResp.getRequested_Action());
            LOG.info("WebClientRestContoller.getNoOfDaysOfApplicationBycellNo--End");
        

        return authResp;


以上是我的主要代码。我想打印天数的差异(createdAtupdatedAt 之间的天数)。我在哪里写这个逻辑?我记得在java中我们使用System.out.println来显示输出,但是这里我不知道在Postman上显示代码。

下面是我的 DTO:

public class DaysOfApplicationResponseDTO extends BasicResponce

private String createdAt;
private String updatedAt;
private String days;


public String getDays() 
    return days;


public void setDays(String days) 
    this.days = days;

private List<CustomerLoanSummaryResponseDTO> LoanApplicationDummyResponseList;

public String getCreatedAt() 
    return createdAt;


public void setCreatedAt(String createdAt) 
    this.createdAt = createdAt;


public String getUpdatedAt() 
    return updatedAt;


public void setUpdatedAt(String updatedAt) 
    this.updatedAt = updatedAt;


public List<CustomerLoanSummaryResponseDTO> getLoanApplicationDummyResponseList() 
    return LoanApplicationDummyResponseList;


public void setLoanApplicationDummyResponseList(
        List<CustomerLoanSummaryResponseDTO> loanApplicationDummyResponseList) 
    LoanApplicationDummyResponseList = loanApplicationDummyResponseList;


public DaysOfApplicationResponseDTO() 
    super();

public DaysOfApplicationResponseDTO(String createdAt, String UpdatedAt, String days,
        List<CustomerLoanSummaryResponseDTO> loanApplicationDummyResponseList) 
    super();
    this.createdAt = createdAt;
    this.updatedAt = updatedAt;
    this.days = days;
    this.LoanApplicationDummyResponseList = loanApplicationDummyResponseList;



【问题讨论】:

您希望输出到哪里?放入日志文件以控制发生的情况,还是在客户端页面上? 请修改标题,因为标题与实际问题无关! 【参考方案1】:

您可以将服务类(@service 注释)引入您的项目以实现域逻辑。您必须将项目分解并组织成合适的项目结构(为了清晰起见,您的控制器、实体、服务位于不同的包中)。最好阅读这些以获取更多信息。

这是一个有用的堆栈溢出问题, What is the recommended project structure for spring boot rest projects?

【讨论】:

以上是关于unity3d在android安卓中用啥代替pc上的OnMouseDown函数的主要内容,如果未能解决你的问题,请参考以下文章

java Spring Boot中用啥代替“System.out.println”

如何用unity3d创建安卓动态壁纸?

既然Unity3D可以开发ios和android,那它可不可以代替ios和android?

在安卓上 我想在浏览指定网页的时候,在网页上追加一段js脚本,请问有啥办法?

市面上有一款android的按键精灵,他是基于啥原理实现的实现

Android TV 应用程序的持续状态? (在Android上用啥代替通知栏)