private void InitTrainButtons(Button button, int i) { button.onClick.AddListener(() => { RestTrainButtonColor(); TrainButtons[i].OnClick(); TiltleText.text = TrainButtons[i].text.text; TrainModelData data = new TrainModelData(); TrainModel trainModel = (TrainModel)Enum.ToObject(typeof(TrainModel), i); data.trainModel = trainModel.ToString(); UdpSclient.Instance.SendDataToSever(ParmaterCodes.TrainModelData, data); }); }