Exemplo n.º 1
0
        /// <summary>
        /// 手机转移区域
        /// </summary>
        public void ChangeArea(int currentAreaID)
        {
            //无信号状态
            if (currentAreaID == -1)
            {
                var iphoneModel = GetComponent <IphoneModel>();
                if (iphoneModel != null)
                {
                    gameObject.GetComponent <Renderer>().material.color = Color.white;
                }
                iphoneModel.taModel = null;

                if (iphoneModel.iphoneID == 1)
                {
                    CommunicationEntity entity = (CommunicationEntity)GameObject.Find("RootUI").GetComponent <CommunicationViewModel>().DataEntity;
                    entity.isCanRingUp   = false;
                    entity.isCellStandby = false;
                }
            }
            else
            {
                if (iphoneModel.iphoneID == 1)
                {
                    CommunicationEntity entity = (CommunicationEntity)GameObject.Find("RootUI").GetComponent <CommunicationViewModel>().DataEntity;
                    if (string.IsNullOrEmpty(entity.phoneNumber))
                    {
                        entity.isCanRingUp = false;
                    }
                    else
                    {
                        entity.isCanRingUp = true;
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 拨打电话
        /// </summary>
        public void RingUp()
        {
            //保存当前的打电话与接电话的链接
            CommunicationEntity entity = (CommunicationEntity)GameObject.Find("RootUI").GetComponent <CommunicationViewModel>().DataEntity;
            int number = System.Convert.ToInt32(entity.phoneNumber);

            if (number == iphoneModel.iphoneID)
            {
                Debug.Log("占线");
                iphoneEntity.currentState = 0;
                return;
            }

            //获取所有的通信塔传递信号
            var list          = iphoneModel.taModel.taList;
            var currentEntity = (TaEntity)(iphoneModel.taModel.DataEntity);

            if (!currentEntity.currenUseDic.ContainsKey(iphoneModel.iphoneID))
            {
                currentEntity.currenUseDic.Add(iphoneModel.iphoneID, number);
            }
            for (int i = 0; i < list.Count; i++)
            {
                var model    = list[i].GetComponent <TaModel>();
                var taEntity = (TaEntity)(model.DataEntity);
                if (!taEntity.currenUseDic.ContainsKey(iphoneModel.iphoneID))
                {
                    taEntity.currenUseDic.Add(iphoneModel.iphoneID, number);
                }
            }
        }
Exemplo n.º 3
0
 private void Start()
 {
     _communicationEntity = (CommunicationEntity)GetComponent <CommunicationViewModel>().DataEntity;
 }