Exemplo n.º 1
0
    public void InitializeCharacter(CharacterIdentity ci)
    {
        characterIdentity = ci;
        trans             = model.GetComponent <Transform>();
        rigid             = GetComponent <Rigid>();

        mState      = new IdleState();
        mDelayState = new IdleDelayState();

        gameSystemState = SystemOrder.NOTHING;
        inputOrder      = InputOrder.stand;
        attackOrder     = -1;
        walkDirection   = new Vector3(0, 0, 0);
        sightRotation   = new Vector3(0, 0, 0);

        posture     = new Posture(this);
        walkPhase   = 0;
        attackPhase = 0;

        holdingItemIndex = -1;

        if (characterIdentity.isPlayer)
        {
            GetComponent <Basic>().mManager.allManager.SetCamera(gameObject);
            posture.BecomeInvisible();

            targetCharacter = null;
        }
        else
        {
            targetCharacter = GetComponent <Basic>().mManager.allManager.player;
        }
    }
Exemplo n.º 2
0
 private void systemOrderWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     while (true)
     {
         try
         {
             if (!SysBLL.IsOpenIndexForm)
             {
                 continue;
             }
             systemOrder = SystemOrderAccess.getSystemOrder();
             if (!SysBLL.IsOpenIndexForm)
             {
                 continue;
             }
             if ("1".Equals(systemOrder.code))
             {
                 continue;
             }
             log.Write("确认指令执行结果");
             SystemOrderAccess.SaveResualt(systemOrder.data.cmd_no);
             log.Write("开始执行");
             ComputerBLL.executeOrder(systemOrder);
         }
         catch (Exception ex)
         {
             log.Write("error:获取命令异常:" + ex.Message);
         }
         Thread.Sleep((1000 * 60) * 5);
     }
 }
Exemplo n.º 3
0
    public void GetOrder()
    {
        //process system order first
        SystemOrder systemOder = characterIdentity.GetSystemOrder();

        gameSystemState ^= systemOder;
        if (systemOder != SystemOrder.NOTHING)
        {
            GetComponent <Basic>().mManager.allManager.uiManager.ProcessSystemOrder(gameSystemState);
        }

        //process gameplay order
        if (gameSystemState == SystemOrder.NOTHING)
        {
            GameObject target = FindTarget(); //woud be better put in lateupdate (after fixing physics)

            inputOrder    = characterIdentity.GetInputOrder();
            walkDirection = characterIdentity.GetWalkingDirection();
            sightRotation = characterIdentity.GetSightRotation(gameObject, target);
            attackOrder   = characterIdentity.GetAttackOrder();

            if (characterIdentity.GetThrowOrder())
            {
                ThrowHoldingItem();
            }
        }
        else
        {
            inputOrder    = InputOrder.stand;
            walkDirection = Vector3.zero;
            sightRotation = Vector3.zero;
            attackOrder   = -1;
        }
    }
Exemplo n.º 4
0
            public static int GetSystemOrderIndex(string system)
            {
                int index = SystemOrder.IndexOf(system);

                if (index == -1)
                {
                    index = SystemOrder.Count;
                    SystemOrder.Add(system);
                    return(index);
                }
                else
                {
                    return(index);
                }
            }
 void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         SystemOrder order = (SystemOrder)OrderTable.CurrentRow.DataBoundItem;
         coreService.ShipSystemOrder(order, worker, e);
     }
     catch (InvalidOrderException ex)
     {
         e.Result = ex.Message;
     }
     catch (EYouBaoAccessException ex)
     {
         e.Result = ex.Message;
     }
 }
        private void ShipPlatformOrder(PlatformOrder order, SystemOrder systemOrder)
        {
            EYouBaoMetadata metadata   = Utils.EYouBaoMetadata();
            string          requestURL = String.Format("http://{0}:{1}{2}", metadata.Server, metadata.Port, metadata.ShipURI);
            HttpWebRequest  request    = (HttpWebRequest)WebRequest.Create(requestURL);

            request.Headers.Set("version", metadata.Version);
            request.Headers.Set("authenticate", metadata.Authenticate);
            request.Method      = "POST";
            request.ContentType = "application/xml;charset=UTF-8";
            Encoding encoding = Encoding.GetEncoding("utf-8");

            byte[] postdata = encoding.GetBytes(Utils.GetXmlString(order));
            request.ContentLength = postdata.Length;
            Stream requestStream = request.GetRequestStream();

            requestStream.Write(postdata, 0, postdata.Length);
            requestStream.Close();
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            StreamReader    reader   = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            XPathDocument   doc      = new XPathDocument(reader);
            XPathNavigator  nav      = doc.CreateNavigator();
            XPathNavigator  node     = nav.SelectSingleNode("/order/mailnum");

            if (null != node)
            {
                string mailnum = node.InnerXml;
                try
                {
                    DatabaseHandler handler = Utils.DatabaseHandler();
                    string          sql     = String.Format("UPDATE COPTD SET {0} = '{1}' WHERE {2} = '{3}' AND {4} = '{5}' AND {6} = '{7}' AND TD016='N' AND TD008<>0 AND  (UDF04 IS NULL OR UDF04 = '') ", COL_MAIL_NUM, mailnum, COL_SORDER_TYPE, systemOrder.OrderType, COL_SORDER_NO, systemOrder.OrderNo, COL_PORDER_NO, order.OrderCode);
                    int             count   = handler.Execute(sql);
                }
                catch (SqlException e)
                {
                    MessageBox.Show(String.Format("运单号入库失败,单别:{0},单号:{1},平台单号:{2},生成的运单号:{3},具体错误信息:\r\n{4}", systemOrder.OrderType, systemOrder.OrderNo, order.OrderCode, mailnum, e.Message), "错误");
                }
            }
            else
            {
                // 生成订单失败,数据错误
                node = nav.SelectSingleNode("/response/description");
                string error = node == null ? "生成运单失败。" : node.InnerXml;
                throw new EYouBaoAccessException(error);
            }
        }
Exemplo n.º 7
0
 public void ProcessSystemOrder(SystemOrder systemOrder)
 {
     if ((int)(systemOrder & SystemOrder.OTHER) != 0)
     {
     }
     else if ((int)(systemOrder & SystemOrder.SYSTEM_MENU) != 0)
     {
     }
     else if ((int)(systemOrder & SystemOrder.ITEMBOX) != 0)
     {
         SetPanelActive(itemPanel.gameObject);
         itemPanel.SpecificActive();
     }
     else if (systemOrder == SystemOrder.NOTHING)
     {
         ClearPanelActive();
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 获取命令
        /// </summary>
        /// <returns></returns>
        public static SystemOrder getSystemOrder()
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("t_id", ConfigurationManager.AppSettings["MechineNo"]);
            parameters.Add("id", id);
            string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("systemOrder"), parameters, null);

            log.Write("指令:" + jsonText);
            //反序列化JSON字符串,将JSON字符串转换成LIST列表
            SystemOrder systemOrder = JsonConvert.DeserializeObject <SystemOrder>(jsonText);

            id = systemOrder.data.id;
            if (SysBLL.IsTest.Equals("正式")) // GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id");
            {
                ComputerBLL.WriteOrderID(id);
            }
            else
            {
                SysConfigHelper.writerNode("sysOrderId", id);
            }
            return(systemOrder);
        }
        public Pagination FindSystemOrderList(int pageNo, int pageSize)
        {
            DatabaseHandler handler    = Utils.DatabaseHandler();
            int             totalCount = GetSystemOrderCount(handler);
            Pagination      pagination = new Pagination(pageNo, pageSize, totalCount);
            int             minPageNo  = 1;
            int             maxPageNo  = pagination.getTotalPage();

            pageNo            = pageNo < minPageNo ? minPageNo : pageNo;
            pageNo            = pageNo > maxPageNo ? maxPageNo : pageNo;
            pagination.PageNo = pageNo;

            if (totalCount == 0)
            {
                pagination.Records = new List <object>();
                return(pagination);
            }

            int       firstRecord = (pageNo - 1) * pageSize;
            string    sql         = String.Format("SELECT TOP {0} TC001, TC002 FROM COPTC LEFT JOIN CMSMQ ON TC001=MQ001 WHERE TC027='Y' AND CMSMQ.UDF01='Y' AND (TC001 + '$' + TC002 NOT IN (SELECT TOP {1} TC001 + '$' + TC002 FROM COPTC ORDER BY TC001, TC002)) AND EXISTS (SELECT UDF04 FROM COPTD WHERE TC001 = TD001 AND TC002 = TD002 AND TD016='N' AND TD008<>0 AND (UDF04 IS NULL OR UDF04 = '')) ORDER BY TC001, TC002", pageSize, firstRecord);
            DataSet   dataSet     = handler.Find(sql);
            DataTable table       = dataSet.Tables[0];

            SystemOrder   order;
            List <object> systemOrderList = new List <object>();

            foreach (DataRow row in table.Rows)
            {
                order           = new SystemOrder();
                order.OrderType = Convert.ToString(row[0]);
                order.OrderNo   = Convert.ToString(row[1]);
                systemOrderList.Add(order);
            }

            pagination.Records = systemOrderList;
            return(pagination);
        }
        public void ShipSystemOrder(SystemOrder systemOrder, BackgroundWorker worker, DoWorkEventArgs e)
        {
            List <PlatformOrder> platformOrderList = this.FindPlatformOrderList(systemOrder.OrderType, systemOrder.OrderNo);

            if (platformOrderList.Count == 0)
            {
                MessageBox.Show("该系统订单下不存在平台订单。");
                return;
            }

            int successCount = 0;

            for (int i = 0; i < platformOrderList.Count; i++)
            {
                PlatformOrder platformOrder = platformOrderList[i];

                try
                {
                    ShipPlatformOrder(platformOrder, systemOrder);
                    successCount++;
                    worker.ReportProgress((100 * i) / platformOrderList.Count);
                }
                catch (System.Exception ex)
                {
                    HandleShipException(systemOrder, platformOrder, ex);
                }
            }

            if (successCount == platformOrderList.Count)
            {
                e.Result = "订单发运成功。";
            }
            else
            {
                e.Result = String.Format("订单发运失败,平台订单共{0}个,发运成功{1}个,失败{2}个", platformOrderList.Count, successCount, platformOrderList.Count - successCount);
            }
        }
Exemplo n.º 11
0
        public static bool executeOrder(SystemOrder order)
        {
            try {
                switch (order.data.cmd_no)
                {
                case
                    "1011":    //重启电脑
                    log.Write("重启电脑");
                    Restart();
                    break;

                case
                    "2011":    //缴费系统停用
                    SysBLL.isDisableApp = true;
                    break;

                case
                    "2021":    //吞卡
                    break;

                case
                    "2022":    //退卡
                    break;

                case
                    "2031":    //检查所有设备硬件
                    break;

                case
                    "2041":    //关闭广告程序
                    KillApplication("GCMp4");
                    break;

                case
                    "2042":    //关闭监控程序
                    KillApplication("1413241343241234123");
                    break;

                case
                    "2043":    //关闭更新程序
                    KillApplication("1324123413241324132");
                    break;

                case
                    "2051":    //重启缴费程序
                    ShutDown();
                    break;

                case
                    "2052":    //重启广告播放程序
                    KillApplication("GCMp4");
                    StartApp(System.AppDomain.CurrentDomain.BaseDirectory + "GCMp4.exe");
                    break;

                case
                    "2053":    //重启更新程序
                    StartApp("");
                    break;

                case
                    "2061":    //上传日志
                    if (order.data.cmd_additional != null)
                    {
                        SysConfigHelper.writerNode("Gcmp4PlayIntervalName", (Convert.ToInt32(order.data.cmd_additional) * (1000 * 60)).ToString());
                    }
                    break;

                case
                    "2071":    //静音
                    Mute();
                    break;

                case
                    "2072":    //音量
                    GcManage.WriteYinliangValue(Convert.ToInt32(order.data.cmd_additional).ToString());
                    KillApplication("GCMp4");
                    StartApp(System.AppDomain.CurrentDomain.BaseDirectory + "GCMp4.exe");
                    break;

                case
                    "2081":    //删除指定文件
                    System.IO.File.Delete(order.data.cmd_additional);
                    break;

                case
                    "2091":    //暂停视频广告
                    SysConfigHelper.writerNode("isStopGCMp4", "1");
                    break;

                case
                    "2092":    //播放视频广告
                    SysConfigHelper.writerNode("isStopGCMp4", "2");
                    break;
                }
                return(true);
            }catch (Exception ex)
            {
                log.Write("error:命令执行异常:" + ex.Message + ",命令编号:" + order.data.cmd_no);
                return(false);
            }
        }
 private void HandleShipException(SystemOrder systemOrder, PlatformOrder platformOrder, System.Exception e)
 {
     MessageBox.Show(String.Format("发运失败,单别:{0},单号:{1},平台单号:{2},具体错误信息:\r\n{3}", systemOrder.OrderType, systemOrder.OrderNo, platformOrder.OrderCode, e.Message), "错误");
 }