コード例 #1
0
ファイル: EleDataBase.cs プロジェクト: fengzhaoforever/base
    public bool IsCurDragTarget(EleItem item)
    {
        int      index = StepManager.Instance().CurSetpIndex - 1;
        StepItem temp  = GetOneStepItem(index);

        return(temp.CurDragEleItem.Name.Equals(item.Name));
    }
コード例 #2
0
    /// <summary>
    /// 仪器展示
    /// </summary>
    public IEnumerator EleIntroduceMove()
    {
        EleItem item    = EleDataBase.Instance().EleItems[_eleIntroduceMoveIndex];
        var     tweener = Camera.main.transform.DOMove(item.LookPos, 0.3f);

        tweener.OnStart(() =>
        {
            Camera.main.transform.DORotateQuaternion(item.LookQua, 0.3f);
            if (_eleIntroduceMoveIndex > 0 && _eleIntroduceMoveIndex < EleDataBase.Instance().EleItems.Count)
            {
                EleDataBase.Instance().EleItems[_eleIntroduceMoveIndex - 1].OffHighLighting();
            }
        });
        tweener.OnComplete(() =>
        {
            item.SetHighLighting(true);
            _eleIntroduceMoveIndex++;
        });
        yield return(new WaitForSeconds(2f));

        if (_eleIntroduceMoveIndex < EleDataBase.Instance().EleItems.Count)
        {
            StartCoroutine(EleIntroduceMove());
        }
        else
        {
            Camera.main.transform.DOMove(DefaultTran.position, 0.3f).OnStart(
                () => {
                Camera.main.transform.DORotateQuaternion(DefaultTran.rotation, 0.3f);
                EleDataBase.Instance().EleItems[_eleIntroduceMoveIndex - 1].OffHighLighting();
            }).OnComplete(
                () => StepManager.Instance().ChangeGameState(StepManager.StepState.Gameing));
        }
    }
コード例 #3
0
 public int Save(EleItem EleItem)
 {
     if (EleItem.ELEItemID == 0)
     {
         _context.EleItems.Add(EleItem);
     }
     else
     {
         EleItem _dbEntry = _context.EleItems.Find(EleItem.ELEItemID);
         _dbEntry.TaskID       = EleItem.TaskID;
         _dbEntry.EDMItemID    = EleItem.EDMItemID;
         _dbEntry.LabelName    = EleItem.LabelName;
         _dbEntry.Raw          = EleItem.Raw;
         _dbEntry.Ready        = EleItem.Ready;
         _dbEntry.Required     = EleItem.Required;
         _dbEntry.PartPosition = EleItem.PartPosition;
         _dbEntry.Finished     = EleItem.Finished;
     }
     _context.SaveChanges();
     return(EleItem.ELEItemID);
 }
コード例 #4
0
ファイル: EleDataBase.cs プロジェクト: fengzhaoforever/base
    private void InitData()
    {
        _congfigStep = (ConfigStep)ConfigManager.Instance().GetConfig(ConfigType.ConfigStep);
        Transform tran = GameObject.Find("StepObjs").transform;

        EleItems = new List <EleItem>(tran.childCount);
        for (int i = 0; i < tran.childCount; i++)
        {
            EleItem item = new EleItem(tran.GetChild(i));
            EleItems.Add(item);
        }
        StepItems = new Dictionary <int, StepItem>(5);

        for (int i = 0; i < _congfigStep.ConfigDatas.Count; i++)
        {
            StepItem sItem = new StepItem();
            sItem.Index          = i;
            sItem.Desc           = StepManager.Instance().GetCurStepDesc(i);
            sItem.CurDragEleItem = EleItems.Find(x => x.Name.Equals(_congfigStep.Get(i + 1).dragName));
            sItem.CurCastEleItem = EleItems.Find(x => x.Name.Equals(_congfigStep.Get(i + 1).castName));
            StepItems.Add(i, sItem);
        }
    }
コード例 #5
0
    private void OnMouseDown0()
    {
        _curDragEleItem = null;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100f, (1 << 8)))
        {
            _curDragEleItem = EleDataBase.Instance().GetOneEleItem(hit.collider.name);
            if (EleDataBase.Instance().IsCurDragTarget(_curDragEleItem))
            {
                _goScreenPos    = Camera.main.WorldToScreenPoint(_curDragEleItem.Go.transform.position);
                _offset         = _curDragEleItem.Go.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, _goScreenPos.z));
                _curCastEleItem = EleDataBase.Instance().GetCurStepItem().CurCastEleItem;
                Debug.Log("_curDragEleItem" + _curDragEleItem.Name);
                Debug.Log("_curCastEleItem" + _curCastEleItem.Name);
            }
            else
            {
                _curDragEleItem = null;
            }
        }
    }
コード例 #6
0
        public EleItem GetByID(int EleItemID)
        {
            EleItem _item = _context.EleItems.Find(EleItemID);

            return(_item);
        }
コード例 #7
0
ファイル: EleDataBase.cs プロジェクト: fengzhaoforever/base
    public EleItem GetOneEleItem(string name)
    {
        EleItem one = EleItems.Find(x => x.Name == name);

        return(one);
    }