Example #1
0
    protected override AbstractBehaviour InitScript()
    {
//		if (RingPhone != null)
//			AudioSource.PlayClipAtPoint (RingPhone,phone.transform.position);
        PhoneDevice phoneDevice = phone.GetComponent <PhoneDevice>();

        phoneDevice.Ring();

        this.BName = "AnswerThePhone";

        AbstractBehaviour[] behaviours = new AbstractBehaviour[2];
        GoToBehaviour       behaviour  = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour;

        behaviour.avatarRigidbody = playerRigidbody;
        behaviour.roomToGo        = "Phone";
        behaviour.aStarGameObject = aStar;
//		behaviour.PathInit ();
        behaviour.BName = "Move";
        behaviours [0]  = behaviour;

        UseDeviceBehaviour uDBehaviour = gameObject.AddComponent(typeof(UseDeviceBehaviour)) as UseDeviceBehaviour;

        uDBehaviour.DeviceToUse = phone;
        uDBehaviour.BName       = "Answer";
        behaviours [1]          = uDBehaviour;

//		this.Behaviours = behaviours;
        Sequence sequence = gameObject.AddComponent(typeof(Sequence)) as Sequence;

        sequence.Behaviours = behaviours;

        return(sequence);
    }
Example #2
0
        public DialogEvidenceViewModel(string savePath)
        {
            mstrSavePath = savePath;

            //
            // 获取已有的案件
            //
            try
            {
                this.ListCase = new ObservableCollection <Case>(caseManager.GetCaseByWhere("all"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, _clew);
            }

            //
            // 自动生成案件编号
            //
            gsid = CommonUtil.Rulename.GetCaseautoid().ToString();
            string caseno1 = CommonUtil.Rulename.GetCaseNoName();

            var strCasePath = ConfigurationManager.AppSettings["caseDefaultPath"].ToString();;

            int limax = 0;

            if (Directory.Exists(strCasePath))
            {
                DirectoryInfo cDIR = new DirectoryInfo(strCasePath);
                foreach (DirectoryInfo dir in cDIR.GetDirectories())
                {
                    if (dir.Name.IndexOf(caseno1) == 0 && dir.Name.IndexOf("_") > 0)
                    {
                        //found the old case folder double check the no
                        string lstmp = dir.Name.Substring(caseno1.Length, dir.Name.IndexOf("_") - caseno1.Length);
                        try
                        {
                            if (Convert.ToInt32(lstmp) > limax)
                            {
                                limax = Convert.ToInt32(lstmp);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.Write(ex.ToString());
                        }
                    }
                }
            }
            if (limax > Convert.ToInt32(gsid))
            {
                gsid = (limax + 1).ToString();
            }

            //
            // 自动生成物证编号
            //
            string strNumberNew = CommonUtil.Rulename.GetEvidenceNo();

            PhoneDevice pd = CommonUtil.CurrentPD;

            if (pd.Phone_model != null)
            {
                this.EvidenceName = pd.Phone_model;
            }
            if (pd.Phone_number != null)
            {
                this.Phone1 = pd.Phone_number;
            }
            if (pd.Case_ai_file != null)
            {
                lgcase_file = pd.Case_ai_file;
                if (pd.Case_ai_file.IndexOf("Aimp_") > 0 && pd.Case_ai_file.IndexOf("Case.ai") > 0)
                {
                    string lstmp = pd.Case_ai_file.Substring(pd.Case_ai_file.IndexOf("Aimp_") + 5, pd.Case_ai_file.IndexOf("Case.ai") - pd.Case_ai_file.IndexOf("Aimp_") - 6);

                    if (strNumberNew.IndexOf("_") > 0)
                    {
                        strNumberNew = strNumberNew.Substring(0, strNumberNew.IndexOf("_")) + "_" + lstmp;
                    }
                    if (this.EvidenceName.IndexOf(":") > 0)
                    {
                        this.EvidenceName = this.EvidenceName.Substring(0, this.EvidenceName.IndexOf(":")) + ":" + lstmp;
                    }
                }
            }

            // 添加新的物证
            Evidence eviNew = new Evidence()
            {
                EVIDENCE_NUMBER = strNumberNew
            };

            this.ListEvidence.Insert(0, eviNew);
            this.EvidenceSelected = strNumberNew;

            // 添加新的案件
            this.CaseSelected = caseno1 + gsid;
            Case caseNew = new Case()
            {
                CASE_NUMBER = this.CaseSelected
            };

            this.ListCase.Insert(0, caseNew);
        }
Example #3
0
 /// <summary>
 /// 获取单例的函数接口
 /// </summary>
 /// <returns></returns>
 public static PhoneDevice GetInstance()
 {
     return(instance != null ? instance : instance = new PhoneDevice());
 }